CI can download Linux dependencies so the server can build images without npm. Co-authored-by: Cursor <cursoragent@cursor.com>
30 lines
678 B
Docker
30 lines
678 B
Docker
# syntax=docker/dockerfile:1
|
|
# Offline frontend image. Build context is the frontend source tree
|
|
# plus ./offline-npm-cache. nginx.conf must be in that context.
|
|
|
|
FROM node:22.18.0-bookworm AS build
|
|
|
|
WORKDIR /app
|
|
|
|
ARG VITE_API_URL=/api
|
|
ENV VITE_API_URL=${VITE_API_URL}
|
|
|
|
COPY offline-npm-cache /offline-npm-cache
|
|
COPY package.json package-lock.json ./
|
|
|
|
RUN npm ci --offline --cache /offline-npm-cache --no-audit --no-fund \
|
|
&& rm -rf /offline-npm-cache /root/.npm
|
|
|
|
COPY . .
|
|
|
|
RUN npm run build
|
|
|
|
FROM nginx:1.27-alpine AS production
|
|
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
COPY --from=build /app/dist /usr/share/nginx/html
|
|
|
|
EXPOSE 80
|
|
|
|
CMD ["nginx", "-g", "daemon off;"]
|