-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.prod
More file actions
39 lines (27 loc) · 886 Bytes
/
Dockerfile.prod
File metadata and controls
39 lines (27 loc) · 886 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
# Build stage
FROM node:20-alpine AS build
# Set working directory
WORKDIR /app
# Copy package.json and package-lock.json
COPY app/package*.json ./
# Install dependencies
RUN npm ci
# Copy the rest of the application code
COPY app/ ./
# Generate content index first
RUN npm run generate-index
# Build the application
RUN npm run build
# Production stage
FROM nginx:alpine AS production
# Copy the build output to replace the default nginx contents
COPY --from=build /app/dist /usr/share/nginx/html
# Copy custom nginx configuration if needed
COPY nginx/default.conf /etc/nginx/conf.d/default.conf
# Expose port 80
EXPOSE 80
# Health check to verify the application is running
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD wget --quiet --tries=1 --spider http://localhost:80/ || exit 1
# Start Nginx server
CMD ["nginx", "-g", "daemon off;"]