28 lines
713 B
Docker
28 lines
713 B
Docker
# ---- Build stage -----------------------------------------------------
|
|
FROM node:22-alpine AS build
|
|
|
|
WORKDIR /app
|
|
|
|
# Backend URLs are baked in at build time (Vite inlines VITE_* variables).
|
|
ARG VITE_API_BASE=https://localhost:3000
|
|
ARG VITE_WS_BASE
|
|
ENV VITE_API_BASE=$VITE_API_BASE
|
|
ENV VITE_WS_BASE=$VITE_WS_BASE
|
|
|
|
COPY package*.json ./
|
|
RUN npm install
|
|
|
|
COPY . .
|
|
RUN npm run build
|
|
|
|
# Production stage
|
|
FROM nginx:stable-alpine as production-stage
|
|
# Remove default nginx website
|
|
RUN rm -rf /usr/share/nginx/html/*
|
|
# Copy built files
|
|
COPY --from=build-stage /app/dist /usr/share/nginx/html
|
|
# Copy custom nginx configuration
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
EXPOSE 80
|
|
CMD ["nginx", "-g", "daemon off;"]
|