Skip to content

Commit 9233667

Browse files
committed
matrix to build images
1 parent ee3a7d1 commit 9233667

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

.github/workflows/docker.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ on:
66
jobs:
77
build:
88
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
image: [backend, clickhouse]
912
steps:
1013
- run: echo "TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
1114

@@ -22,18 +25,18 @@ jobs:
2225
username: ${{ github.actor }}
2326
password: ${{ secrets.GITHUB_TOKEN }}
2427

25-
- name: Build and push
26-
id: docker_build
28+
- name: Build and push (${{ matrix.image }})
29+
id: build-image
2730
uses: docker/build-push-action@v5
2831
with:
2932
push: true
3033
tags: |
31-
ghcr.io/talodev/backend:latest
32-
ghcr.io/talodev/backend:${{ env.TAG }}
33-
target: prod
34+
ghcr.io/talodev/${{ matrix.image }}:latest
35+
ghcr.io/talodev/${{ matrix.image }}:${{ env.TAG }}
36+
target: ${{ matrix.image == 'backend' && 'prod' || '' }}
3437

35-
- name: Image digest
36-
run: echo ${{ steps.docker_build.outputs.digest }}
38+
- name: Image digest (${{ matrix.image }})
39+
run: echo ${{ steps.build-image.outputs.digest }}
3740

3841
deploy:
3942
runs-on: ubuntu-latest

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ COPY src ./src
1616
RUN npm run build
1717

1818
FROM base AS prod
19-
ENV NODE_ENV production
19+
ENV NODE_ENV=production
2020
RUN npm ci
2121
COPY --from=build /usr/backend/dist .
2222
CMD [ "node", "index.js" ]

0 commit comments

Comments
 (0)