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
9
1
FROM node:24-alpine
10
2
11
- # install pnpm globally
3
+ # Install pnpm globally
12
4
RUN npm install -g pnpm
13
5
14
- # your working dir in container
6
+ # Set working directory
15
7
WORKDIR /usr/src/app
16
8
17
-
18
- # copy only manifest and lockfile, install all deps (including devDependencies)
9
+ # Copy only manifest and lockfile first for better caching
19
10
COPY package.json pnpm-lock.yaml ./
11
+
12
+ # Install all dependencies (including devDependencies for build)
20
13
RUN pnpm install
21
14
22
- # copy source & build
15
+ # Copy the rest of the source code
23
16
COPY . .
17
+
18
+ # Build the app (requires @nestjs/cli as devDependency)
24
19
RUN pnpm build
25
20
26
- # prune devDependencies for smaller final image
21
+ # Prune devDependencies for smaller final image
27
22
RUN pnpm prune --prod
28
23
29
- # ensure entrypoint is executable
24
+ # Ensure entrypoint is executable
30
25
RUN chmod +x docker-entrypoint.sh
31
26
32
- # expose the NestJS port
27
+ # Expose the NestJS port
33
28
EXPOSE 4000
34
29
35
- # run migrations then start
30
+ # Run migrations then start
36
31
ENTRYPOINT ["./docker-entrypoint.sh" ]
You can’t perform that action at this time.
0 commit comments