-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
38 lines (26 loc) · 738 Bytes
/
Dockerfile
File metadata and controls
38 lines (26 loc) · 738 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
# Stage 1: Build the React application
FROM node:22-alpine AS builder
# Set working directory
WORKDIR /app
# Install pnpm globally
RUN npm install -g pnpm
# Copy package management files
COPY package.json pnpm-lock.yaml ./
# Install dependencies
RUN pnpm install --frozen-lockfile
# Copy the rest of the application code
COPY . .
# Build the application
RUN pnpm run build
# Stage 2: Serve the application
FROM node:22-alpine
# Set working directory
WORKDIR /app
# Install 'serve' package globally to host static files
RUN npm install -g serve
# Copy built assets from builder stage
COPY --from=builder /app/dist ./dist
# Expose port 3000
EXPOSE 3000
# Command to run the application
CMD ["serve", "-s", "dist", "-l", "3000"]