forked from cedar-v/license-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.frontend
More file actions
43 lines (30 loc) · 999 Bytes
/
Copy pathDockerfile.frontend
File metadata and controls
43 lines (30 loc) · 999 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
37
38
39
40
41
42
43
# Multi-stage build for frontend
FROM node:20-alpine AS builder
WORKDIR /app
COPY frontend/package.json ./
# Install dependencies (ignore package-lock.json since it's outdated)
RUN npm install
COPY frontend/ ./
# Set build environment variables
ENV VITE_OUTDIR=dist
ENV VITE_ADDRESS_BASE_URL=/
# Build the project and verify output
RUN npm run build:prod && ls -la && ls -la dist/
# Production stage with Nginx
FROM nginx:alpine
# Copy built assets
COPY --from=builder /app/dist /usr/share/nginx/html
# Selectable nginx configuration (default: nginx.conf). Use build-arg to switch.
ARG NGINX_CONF=nginx.conf
ENV NGINX_CONF=${NGINX_CONF}
COPY ${NGINX_CONF} /etc/nginx/conf.d/default.conf
# Create log directory
RUN mkdir -p /var/log/nginx
# Install curl for health check
RUN apk add --no-cache curl
# Expose port
EXPOSE 80
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD curl -f http://localhost/ || exit 1
CMD ["nginx", "-g", "daemon off;"]