File tree Expand file tree Collapse file tree 1 file changed +12
-17
lines changed
Expand file tree Collapse file tree 1 file changed +12
-17
lines changed Original file line number Diff line number Diff line change 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
91FROM node:24-alpine
102
11- # install pnpm globally
3+ # Install pnpm globally
124RUN npm install -g pnpm
135
14- # your working dir in container
6+ # Set working directory
157WORKDIR /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
1910COPY package.json pnpm-lock.yaml ./
11+
12+ # Install all dependencies (including devDependencies for build)
2013RUN pnpm install
2114
22- # copy source & build
15+ # Copy the rest of the source code
2316COPY . .
17+
18+ # Build the app (requires @nestjs/cli as devDependency)
2419RUN pnpm build
2520
26- # prune devDependencies for smaller final image
21+ # Prune devDependencies for smaller final image
2722RUN pnpm prune --prod
2823
29- # ensure entrypoint is executable
24+ # Ensure entrypoint is executable
3025RUN chmod +x docker-entrypoint.sh
3126
32- # expose the NestJS port
27+ # Expose the NestJS port
3328EXPOSE 4000
3429
35- # run migrations then start
30+ # Run migrations then start
3631ENTRYPOINT ["./docker-entrypoint.sh" ]
You can’t perform that action at this time.
0 commit comments