forked from CodeWithCJ/SparkyFitness
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.frontend
More file actions
34 lines (24 loc) · 901 Bytes
/
Dockerfile.frontend
File metadata and controls
34 lines (24 loc) · 901 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
# Stage 1: Build the React application
FROM node:20-slim AS builder
WORKDIR /app/SparkyFitnessFrontend
# Copy package files and install dependencies
COPY SparkyFitnessFrontend/package.json SparkyFitnessFrontend/package-lock.json ./
RUN npm install
# Copy the rest of the application source code
COPY SparkyFitnessFrontend .
# Build the application
RUN npm run build
# Stage 2: Serve the application with Nginx
FROM nginx:alpine
# Install bash for console access
RUN apk add --no-cache bash
# Copy the build output from the builder stage
COPY --from=builder /app/SparkyFitnessFrontend/dist /usr/share/nginx/html
# Copy the nginx configuration file
COPY SparkyFitnessFrontend/nginx.conf /etc/nginx/conf.d/default.conf
# Expose port 80
EXPOSE 80
# Healthcheck
HEALTHCHECK --interval=5s --timeout=10s --retries=5 CMD ["curl", "http://127.0.0.1"]
# Start Nginx
CMD ["nginx", "-g", "daemon off;"]