Remote frontend nginx now forwards API requests to Django so login and registration work when the host proxy only routes to port 8080. Co-authored-by: Cursor <cursoragent@cursor.com>
32 lines
655 B
Docker
32 lines
655 B
Docker
# syntax=docker/dockerfile:1
|
|
|
|
FROM node:20-alpine AS build
|
|
|
|
WORKDIR /app
|
|
|
|
COPY package.json package-lock.json ./
|
|
RUN npm ci
|
|
|
|
COPY . .
|
|
|
|
ARG VITE_DATA_MODE=local
|
|
ENV VITE_DATA_MODE=${VITE_DATA_MODE}
|
|
|
|
RUN npm run build
|
|
|
|
FROM nginx:1.27-alpine AS runtime
|
|
|
|
ARG VITE_DATA_MODE=local
|
|
COPY nginx.conf /tmp/nginx.local.conf
|
|
COPY nginx.remote.conf /tmp/nginx.remote.conf
|
|
RUN if [ "$VITE_DATA_MODE" = "remote" ]; then \
|
|
cp /tmp/nginx.remote.conf /etc/nginx/conf.d/default.conf; \
|
|
else \
|
|
cp /tmp/nginx.local.conf /etc/nginx/conf.d/default.conf; \
|
|
fi
|
|
COPY --from=build /app/dist /usr/share/nginx/html
|
|
|
|
EXPOSE 80
|
|
|
|
CMD ["nginx", "-g", "daemon off;"]
|