File tree Expand file tree Collapse file tree 2 files changed +17
-15
lines changed Expand file tree Collapse file tree 2 files changed +17
-15
lines changed Original file line number Diff line number Diff line change 9
9
- uses : actions/checkout@v2
10
10
with :
11
11
ref : ${{ github.event.release.target_commitish }}
12
- - uses : actions/setup-node@v4
13
- with :
14
- node-version : 20.x
15
- - name : Build pipeline code
16
- run : |
17
- npm ci
18
- npm run build
19
- - name : Trim down devDependencies
20
- run : npm prune --production
21
12
- name : Build docker image
22
13
run : docker build --build-arg NODE_TAG=20 .
Original file line number Diff line number Diff line change 1
- ARG NODE_TAG=latest
1
+ ARG NODE_TAG
2
+ FROM node:${NODE_TAG}-alpine AS builder
3
+
4
+ # `WORKDIR` will create the folder if it doesn't exsist
5
+ WORKDIR /build-stage
6
+ COPY package*.json ./
7
+ RUN npm ci
8
+ COPY . ./
9
+ RUN npm run build
10
+
11
+ # This remove dev dependencies from `node_modules` folder
12
+ RUN npm prune --production
13
+
2
14
FROM node:${NODE_TAG}-alpine
3
15
4
- RUN mkdir /pipe
5
16
WORKDIR /pipe
6
17
7
18
# The `--force` flag force replace `yarn` if it exist in base image
8
19
# This ensure we have the latest version of package managers
9
20
RUN npm install -g --force npm pnpm yarn
10
21
11
- COPY node_modules ./node_modules
12
- COPY dist/ ./
13
- COPY entrypoint.sh package.json ./
22
+ COPY --from=builder /build-stage/ node_modules ./node_modules
23
+ COPY --from=builder /build-stage/ dist/ ./
24
+ COPY --from=builder /build-stage/ entrypoint.sh ./
14
25
15
- RUN chmod a+x ./**/*.js entrypoint.sh
26
+ RUN chmod a+x entrypoint.sh
16
27
17
28
ENTRYPOINT ["/pipe/entrypoint.sh" ]
You can’t perform that action at this time.
0 commit comments