Skip to content

Commit 5ee1dce

Browse files
Fixing Dockerfile.
1 parent 5b2d19f commit 5ee1dce

File tree

1 file changed

+12
-17
lines changed

1 file changed

+12
-17
lines changed

Dockerfile

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,31 @@
1-
# Ensure devDependencies are installed for build
2-
# Install pnpm if not present, then install all dependencies including devDependencies
3-
RUN corepack enable && corepack prepare pnpm@latest --activate
4-
RUN pnpm install
5-
6-
# Build the app (nest CLI will be available)
7-
RUN pnpm build
8-
# syntax=docker/dockerfile:1
91
FROM node:24-alpine
102

11-
# install pnpm globally
3+
# Install pnpm globally
124
RUN npm install -g pnpm
135

14-
# your working dir in container
6+
# Set working directory
157
WORKDIR /usr/src/app
168

17-
18-
# copy only manifest and lockfile, install all deps (including devDependencies)
9+
# Copy only manifest and lockfile first for better caching
1910
COPY package.json pnpm-lock.yaml ./
11+
12+
# Install all dependencies (including devDependencies for build)
2013
RUN pnpm install
2114

22-
# copy source & build
15+
# Copy the rest of the source code
2316
COPY . .
17+
18+
# Build the app (requires @nestjs/cli as devDependency)
2419
RUN pnpm build
2520

26-
# prune devDependencies for smaller final image
21+
# Prune devDependencies for smaller final image
2722
RUN pnpm prune --prod
2823

29-
# ensure entrypoint is executable
24+
# Ensure entrypoint is executable
3025
RUN chmod +x docker-entrypoint.sh
3126

32-
# expose the NestJS port
27+
# Expose the NestJS port
3328
EXPOSE 4000
3429

35-
# run migrations then start
30+
# Run migrations then start
3631
ENTRYPOINT ["./docker-entrypoint.sh"]

0 commit comments

Comments
 (0)