improving build steps
This commit is contained in:
26
OpenCand.UI.dockerfile
Normal file
26
OpenCand.UI.dockerfile
Normal file
@@ -0,0 +1,26 @@
|
||||
# ─── Stage 1: Build ───────────────────────────────────────────────────────
|
||||
FROM node:slim AS builder
|
||||
WORKDIR /app
|
||||
|
||||
COPY package.json yarn.lock ./
|
||||
RUN yarn install --frozen-lockfile
|
||||
|
||||
COPY . .
|
||||
|
||||
ARG VITE_API_BASE_URL
|
||||
ENV VITE_API_BASE_URL=${VITE_API_URL}
|
||||
|
||||
RUN yarn build
|
||||
|
||||
# ─── Stage 2: Serve ────────────────────────────────────────────────────────
|
||||
FROM nginx:stable-alpine
|
||||
# Remove default nginx html
|
||||
RUN rm -rf /usr/share/nginx/html/*
|
||||
# Copy our built files into nginx’s html folder
|
||||
COPY --from=builder /app/dist /usr/share/nginx/html
|
||||
|
||||
# (Optional) If you need any custom nginx.conf, COPY it here—
|
||||
# e.g. COPY nginx.conf /etc/nginx/nginx.conf
|
||||
|
||||
EXPOSE 80
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
Reference in New Issue
Block a user