Skip to content

Commit 481070c

Browse files
authored
Merge pull request #489 from sir-gon/develop
Develop
2 parents 1c36035 + 5911664 commit 481070c

File tree

4 files changed

+28
-8
lines changed

4 files changed

+28
-8
lines changed

.github/workflows/docker-image.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,27 @@ jobs:
1717
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4
1818
- name: Build the Docker image
1919
run: make compose/rebuild
20+
- name: Run static checks in Docker image
21+
run: make compose/lint
2022
- name: Run test in Docker image
2123
run: make compose/run
2224
- name: Tag Docker image
2325
run: docker tag algorithm-exercises-py:latest algorithm-exercises-py:${{ github.sha }}
26+
27+
- name: Run Snyk to check Docker image for vulnerabilities
28+
# Snyk can be used to break the build when it detects vulnerabilities.
29+
# In this case we want to upload the issues to GitHub Code Scanning
30+
continue-on-error: true
31+
uses: snyk/actions/docker@master
32+
env:
33+
# In order to use the Snyk Action you will need to have a Snyk API token.
34+
# See https://docs.snyk.io/integrations/ci-cd-integrations/github-actions-integration#getting-your-snyk-token
35+
# or you can sign up for free at https://snyk.io/login
36+
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
37+
with:
38+
image: algorithm-exercises-py:latest
39+
args: --file=Dockerfile
40+
# - name: Upload result to GitHub Code Scanning
41+
# uses: github/codeql-action/upload-sarif@v2
42+
# with:
43+
# sarif_file: snyk.sarif

Dockerfile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,15 @@ ENV WORKDIR=/app
55
WORKDIR ${WORKDIR}
66

77
###############################################################################
8-
FROM node:20.14.0-alpine3.20 AS lint
8+
FROM base AS lint
99

1010
ENV WORKDIR=/app
1111
WORKDIR ${WORKDIR}
1212

1313
COPY ./src ${WORKDIR}/src
14-
RUN apk add --update --no-cache make
15-
RUN npm install -g --ignore-scripts markdownlint-cli
14+
RUN apk add --update --no-cache make nodejs npm
1615

17-
RUN apk add --update --no-cache nodejs npm
16+
RUN npm install -g --ignore-scripts markdownlint-cli
1817
RUN npm install -g --ignore-scripts pyright
1918

2019
###############################################################################

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ clean:
110110
find . -path "*/__pycache__" -type d -print -exec rm -fr {} ';'
111111

112112
compose/build: env
113+
docker-compose --profile lint build
113114
docker-compose --profile testing build
114115

115116
compose/rebuild: env
@@ -118,10 +119,10 @@ compose/rebuild: env
118119

119120
compose/mdlint: env
120121
docker-compose --profile lint build
121-
docker-compose --profile lint run --rm algorithm-exercises-py-mdlint make mdlint
122+
docker-compose --profile lint run --rm algorithm-exercises-py-lint make mdlint
122123

123124
compose/test/static: compose/build
124-
docker-compose --profile testing run --rm algorithm-exercises-py make test/static
125+
docker-compose --profile lint run --rm algorithm-exercises-py-lint make test/static
125126

126127
compose/lint: compose/test/static compose/mdlint
127128

compose.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ services:
1111
- ./coverage:/app/coverage
1212
profiles: ["testing"]
1313

14-
algorithm-exercises-py-mdlint:
15-
image: algorithm-exercises-ts:mdlint
14+
algorithm-exercises-py-lint:
15+
image: algorithm-exercises-py:lint
1616
build:
1717
context: .
1818
target: lint

0 commit comments

Comments
 (0)