Skip to content

Commit b120ed4

Browse files
MI-85: Update build steps
1 parent e0f8881 commit b120ed4

File tree

2 files changed

+17
-15
lines changed

2 files changed

+17
-15
lines changed

.github/workflows/build.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,5 @@ jobs:
99
- uses: actions/checkout@v2
1010
with:
1111
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
2112
- name: Build docker image
2213
run: docker build --build-arg NODE_TAG=20 .

Dockerfile

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,28 @@
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+
214
FROM node:${NODE_TAG}-alpine
315

4-
RUN mkdir /pipe
516
WORKDIR /pipe
617

718
# The `--force` flag force replace `yarn` if it exist in base image
819
# This ensure we have the latest version of package managers
920
RUN npm install -g --force npm pnpm yarn
1021

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 ./
1425

15-
RUN chmod a+x ./**/*.js entrypoint.sh
26+
RUN chmod a+x entrypoint.sh
1627

1728
ENTRYPOINT ["/pipe/entrypoint.sh"]

0 commit comments

Comments
 (0)