Skip to content

Commit 4f04017

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

File tree

1 file changed

+38
-14
lines changed

1 file changed

+38
-14
lines changed

.github/workflows/docker-image.yml

Lines changed: 38 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on: # yamllint disable-line rule:truthy
99
branches: ["main"]
1010

1111
env:
12-
IMAGE_NAME: algorithm-exercises-js
12+
IMAGE_NAME: ${{ env.IMAGE_NAME }}
1313

1414
jobs:
1515

@@ -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
25-
- name: Lint in Docker image
26-
run: make compose/lint
27-
- name: Test in Docker image
28-
run: make compose/test
29-
- name: Run in Docker image
30-
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 }}
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: ${{ env.IMAGE_NAME }}:${{ github.sha }}
36+
path: /tmp/${{ env.IMAGE_NAME }}_${{ github.sha }}.tar
37+
38+
# - name: Lint in Docker image
39+
# run: make compose/lint
40+
# - name: Test in Docker image
41+
# run: make compose/test
42+
# - name: Run in Docker image
43+
# run: make compose/run
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: ${{ env.IMAGE_NAME }}:${{ github.sha }}
54+
path: /tmp/${{ env.IMAGE_NAME }}_${{ github.sha }}.tar
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)