修正构建文件

main
mula.liu 2025-12-03 00:07:29 +08:00
parent 1987afeb10
commit c2a2307b34
2 changed files with 6 additions and 3 deletions

View File

@ -103,7 +103,9 @@ services:
context: ./frontend
dockerfile: Dockerfile
args:
VITE_API_BASE_URL: ${VITE_API_BASE_URL:-http://localhost/api}
# Don't set VITE_API_BASE_URL to use relative path /api (recommended)
# This allows the frontend to work with any domain/IP
VITE_API_BASE_URL: ${VITE_API_BASE_URL:-}
container_name: cosmo_frontend
restart: unless-stopped
volumes:

View File

@ -17,8 +17,9 @@ RUN npm install
# Copy source code
COPY . .
# Build argument for API URL
ARG VITE_API_BASE_URL=http://localhost/api
# Build argument for API URL (optional)
# If not set, frontend will use relative path /api (recommended for production)
ARG VITE_API_BASE_URL
ENV VITE_API_BASE_URL=$VITE_API_BASE_URL
# Build the application (skip TypeScript check for faster builds)