-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
36 lines (24 loc) · 846 Bytes
/
Copy pathDockerfile
File metadata and controls
36 lines (24 loc) · 846 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
FROM node:22-alpine AS build
WORKDIR /app
# Update Alpine packages to latest security patches
RUN apk update && apk upgrade --no-cache
# Install dependencies
COPY package.json package-lock.json* ./
RUN npm install --silent
# Copy source and build
COPY . .
# Build argument for analytics (default: disabled for test environments)
ARG ENABLE_ANALYTICS=false
ENV VITE_ENABLE_ANALYTICS=${ENABLE_ANALYTICS}
RUN npm run build
FROM nginx:alpine AS production
# Update packages to ensure latest security patches
RUN apk update && apk upgrade --no-cache
# Remove default nginx website
RUN rm -rf /usr/share/nginx/html/*
# Copy built assets from the builder
COPY --from=build /app/dist /usr/share/nginx/html
# Add custom nginx config for SPA routing
COPY ./nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]