-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
33 lines (22 loc) · 1 KB
/
Dockerfile
File metadata and controls
33 lines (22 loc) · 1 KB
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
# ---------- Build stage ----------
FROM node:20-alpine AS builder
# Accept API base URL at build time and expose to Vite
ARG VITE_API_BASE_URL
ENV VITE_API_BASE_URL=${VITE_API_BASE_URL}
WORKDIR /app
# Install dependencies using lockfile for reproducibility
COPY package*.json ./
COPY serenibase-sdk-1.0.0.tgz ./
RUN npm install --no-audit --no-fund
# Copy source
COPY . .
# Build app
RUN npm run build
# ---------- Runtime stage ----------
FROM nginx:1.29.4-alpine AS runner
# Replace default server config with SPA-friendly fallback on port 5050 and log to stdout/stderr
RUN printf '%s\n' 'server {' ' listen 5050;' ' server_name _;' '' ' access_log /dev/stdout;' ' error_log /dev/stderr warn;' '' ' root /usr/share/nginx/html;' ' index index.html;' '' ' location / {' ' try_files $uri $uri/ /index.html;' ' }' '}' > /etc/nginx/conf.d/default.conf
# Copy built assets from builder
COPY --from=builder /app/dist /usr/share/nginx/html
EXPOSE 5050
# Use Nginx default entrypoint/cmd