diff --git a/docker-compose.yml b/docker-compose.yml index 89d7036..df516a5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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: diff --git a/frontend/Dockerfile b/frontend/Dockerfile index f9df441..c010e4d 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -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)