-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
36 lines (25 loc) · 821 Bytes
/
Dockerfile
File metadata and controls
36 lines (25 loc) · 821 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Stage 1 — Build
FROM node:22-alpine AS build
WORKDIR /app
ARG BACKEND_URL
ENV VITE_BACKEND_URL=$BACKEND_URL
COPY package.json package-lock.json ./
RUN npm ci
COPY . .
RUN npm run build
# Stage 2 — Serve
FROM nginx:alpine
# Remove default nginx config
RUN rm /etc/nginx/conf.d/default.conf
# Copy nginx template (envsubst replaces ${API_BACKEND_URL} at container start)
COPY docker/nginx.conf.template /etc/nginx/templates/default.conf.template
COPY docker/cert.pem /etc/nginx/ssl/
COPY docker/key.pem /etc/nginx/ssl/
# Copy built static files
COPY --from=build /app/dist /usr/share/nginx/html
# Only substitute our variable, not nginx's own $uri, $host, etc.
ENV NGINX_ENVSUBST_FILTER=API_
# Default backend URL (override at runtime with -e)
ENV API_BACKEND_URL=https://backend:8443
EXPOSE 80
EXPOSE 443