Skip to content

Commit 5dfb9bb

Browse files
committed
feat: add Dockerfile
1 parent febc208 commit 5dfb9bb

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

Dockerfile

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Stage 1: Build the app
2+
FROM node:23-alpine AS build
3+
4+
# Install pnpm
5+
RUN corepack enable
6+
7+
WORKDIR /app
8+
9+
# Copy only package.json and pnpm-lock.yaml to leverage caching
10+
COPY package.json pnpm-lock.yaml* ./
11+
12+
# Install dependencies using pnpm
13+
RUN pnpm install
14+
15+
# Copy the rest of the application code
16+
COPY . .
17+
18+
# Build the application
19+
RUN pnpm build
20+
21+
# Stage 2: Serve the app with a minimal web server
22+
FROM nginx:alpine
23+
24+
# Copy built files from the previous stage to the Nginx web server's public directory
25+
COPY --from=build /app/dist /usr/share/nginx/html
26+
27+
# Expose port 80
28+
EXPOSE 80
29+
30+
# Start Nginx
31+
CMD ["nginx", "-g", "daemon off;"]

0 commit comments

Comments
 (0)