-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
43 lines (29 loc) · 961 Bytes
/
Dockerfile
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
# Use a minimal Node.js base image
FROM node:bullseye AS base
# Enable pnpm
RUN corepack enable && corepack prepare pnpm@latest --activate
# Builder stage
FROM base AS builder
# Set the working directory inside the container
WORKDIR /app
# Copy package.json and pnpm-lock.yaml
COPY package.json pnpm-lock.yaml ./
# Install dependencies
RUN pnpm install --frozen-lockfile
# Copy the rest of the project files
COPY . .
# Build the React app
RUN pnpm run build
# Final runtime image
FROM nginx:alpine
# Copy the built files from the builder image
COPY --from=builder /app/build /usr/share/nginx/html
# Copy nginx config to the container
COPY nginx.conf /etc/nginx/conf.d/default.conf
# Copy the entrypoint script
COPY entrypoint.sh /usr/share/nginx/entrypoint.sh
# Ensure the entrypoint script is executable
RUN chmod +x /usr/share/nginx/entrypoint.sh
EXPOSE 80
# Set the entrypoint to the custom script
ENTRYPOINT ["/usr/share/nginx/entrypoint.sh"]