Skip to content

Commit 0ffb5ea

Browse files
author
Gonzalo Diaz
committed
[CONFIG] [Gihub Actions] splitted in two jobs.
1 parent 45180d8 commit 0ffb5ea

File tree

1 file changed

+31
-7
lines changed

1 file changed

+31
-7
lines changed

.github/workflows/docker-image.yml

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,43 @@ jobs:
2020

2121
steps:
2222
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
23-
- name: Build the Docker image
24-
run: make compose/rebuild
23+
24+
- name: Build and push
25+
uses: docker/build-push-action@v6
26+
with:
27+
context: .
28+
tags: |
29+
${{ env.IMAGE_NAME }}:latest
30+
${{ env.IMAGE_NAME }}:${{ github.sha }}
31+
32+
- name: Upload artifact
33+
uses: actions/upload-artifact@v4
34+
with:
35+
name: algorithm-exercises-ts:${{ github.sha }}
36+
path: /tmp/algorithm-exercises-ts:${{ github.sha }}.tar
37+
2538
- name: Lint in Docker image
2639
run: make compose/lint
2740
- name: Test in Docker image
2841
run: make compose/test
2942
- name: Run in Docker image
3043
run: make compose/run
31-
- name: Tag Docker image
32-
run: >
33-
docker tag
34-
${{ env.IMAGE_NAME }}:latest
35-
${{ env.IMAGE_NAME }}:${{ github.sha }}
44+
45+
scan:
46+
name: "Snyk Container"
47+
runs-on: ubuntu-latest
48+
needs: build
49+
steps:
50+
- name: Download artifact
51+
uses: actions/download-artifact@v4
52+
with:
53+
name: myimage
54+
path: /tmp
55+
56+
- name: Load image
57+
run: |
58+
docker load --input /tmp/myimage.tar
59+
docker image ls -a
3660
3761
- name: Run Snyk to check Docker image for vulnerabilities
3862
# Snyk can be used to break the build when it detects vulnerabilities.

0 commit comments

Comments
 (0)