fix(frontend): pass VITE_BE_API_URL and VITE_BE_WS_URL as Docker build args
Vite embeds env vars at build time, not runtime. The frontend code uses VITE_BE_API_URL/VITE_BE_WS_URL but the workflow was setting wrong names (VITE_API_URL/VITE_WS_URL). Now Dockerfile accepts build args and workflow passes production URLs during docker build. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
ccd3ccd556
commit
5a094c926a
@@ -1,5 +1,8 @@
|
||||
FROM node:22-alpine
|
||||
|
||||
ARG VITE_BE_API_URL
|
||||
ARG VITE_BE_WS_URL
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Install pnpm
|
||||
@@ -16,10 +19,10 @@ COPY services/frontend ./services/frontend
|
||||
# Install dependencies
|
||||
RUN pnpm install --frozen-lockfile
|
||||
|
||||
# Build frontend
|
||||
RUN pnpm --filter './services/frontend' run build
|
||||
# Build frontend (env vars injected at build time)
|
||||
RUN VITE_BE_API_URL=${VITE_BE_API_URL} VITE_BE_WS_URL=${VITE_BE_WS_URL} pnpm --filter './services/frontend' run build
|
||||
|
||||
# Expose port (served by backend)
|
||||
# Expose port
|
||||
EXPOSE 3000
|
||||
|
||||
# Start frontend (production preview)
|
||||
|
||||
Reference in New Issue
Block a user