25 lines
1.1 KiB
Docker
25 lines
1.1 KiB
Docker
|
|
# ── Stage 1: build the Vite client ────────────────────────────────────────
|
||
|
|
FROM node:22-alpine AS build
|
||
|
|
|
||
|
|
WORKDIR /app/client
|
||
|
|
COPY client/package.json client/package-lock.json* ./
|
||
|
|
RUN npm install
|
||
|
|
COPY client/ .
|
||
|
|
|
||
|
|
# Vite bakes VITE_* vars in at build time, not runtime — has to be a
|
||
|
|
# real build ARG, not just a container env var set later.
|
||
|
|
ARG VITE_SPOTIFY_CLIENT_ID
|
||
|
|
ENV VITE_SPOTIFY_CLIENT_ID=${VITE_SPOTIFY_CLIENT_ID}
|
||
|
|
# Deliberately empty: relies on nginx same-origin-proxying /api to the
|
||
|
|
# api service (see nginx.conf) instead of an absolute cross-origin URL
|
||
|
|
# — the CORS bug that broke local dev earlier in this build.
|
||
|
|
ENV VITE_API_BASE=
|
||
|
|
|
||
|
|
RUN npx tsc && npx vite build
|
||
|
|
|
||
|
|
# ── Stage 2: serve ─────────────────────────────────────────────────────────
|
||
|
|
FROM nginx:alpine
|
||
|
|
COPY --from=build /app/client/dist /usr/share/nginx/html
|
||
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||
|
|
EXPOSE 80
|