-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathDockerfile.ui
More file actions
48 lines (37 loc) · 1.03 KB
/
Dockerfile.ui
File metadata and controls
48 lines (37 loc) · 1.03 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# Build stage
FROM node:22-alpine AS builder
ARG APP_VERSION=""
WORKDIR /app
# Copy package files first for caching
COPY ui/package.json ui/package-lock.json ./
RUN npm ci
# Copy source code
COPY ui/ .
# Remove symlink and create empty results directory for build
RUN rm -f public/results && mkdir -p public/results
# Build the UI (VITE_APP_VERSION is baked in at build time)
ENV VITE_APP_VERSION=${APP_VERSION}
RUN npm run build
# Final stage
FROM nginx:alpine
# Copy built assets
COPY --from=builder /app/dist /usr/share/nginx/html
# Copy nginx config for SPA routing
RUN echo 'server { \
listen 80; \
root /usr/share/nginx/html; \
index index.html; \
location / { \
try_files $uri $uri/ /index.html; \
} \
location /results { \
try_files $uri =404; \
add_header Cache-Control no-transform; \
} \
location /assets { \
expires 1y; \
add_header Cache-Control "public, immutable"; \
} \
}' > /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]