Skip to content

Commit ac70b45

Browse files
author
Gonzalo Diaz
committed
[CONFIG] SNYK added to Docker script for github-actions.
1 parent 67b3ca4 commit ac70b45

File tree

3 files changed

+38
-19
lines changed

3 files changed

+38
-19
lines changed

.github/workflows/docker-image.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,20 @@ jobs:
2525
- name: Tag Docker image
2626
run: docker tag algorithm-exercises-csharp:latest algorithm-exercises-csharp:${{ github.sha }}
2727

28+
- name: Run Snyk to check Docker image for vulnerabilities
29+
# Snyk can be used to break the build when it detects vulnerabilities.
30+
# In this case we want to upload the issues to GitHub Code Scanning
31+
continue-on-error: true
32+
uses: snyk/actions/docker@master
33+
env:
34+
# In order to use the Snyk Action you will need to have a Snyk API token.
35+
# See https://docs.snyk.io/integrations/ci-cd-integrations/github-actions-integration#getting-your-snyk-token
36+
# or you can sign up for free at https://snyk.io/login
37+
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
38+
with:
39+
image: algorithm-exercises-go:latest
40+
args: --file=Dockerfile
41+
# - name: Upload result to GitHub Code Scanning
42+
# uses: github/codeql-action/upload-sarif@v2
43+
# with:
44+
# sarif_file: snyk.sarif

.github/workflows/dotnet-snyk.yml

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,17 @@ on:
1010
branches: [ main ]
1111

1212
jobs:
13-
build:
14-
name: "Run CI"
15-
strategy:
16-
fail-fast: false
17-
matrix:
18-
os: ["windows-latest"]
19-
runs-on: ${{ matrix.os }}
13+
security:
14+
runs-on: ubuntu-latest
2015
steps:
21-
- uses: actions/checkout@v4
22-
- name: Setup .NET
23-
uses: actions/setup-dotnet@v4
24-
with:
25-
dotnet-version: 8.0.x
26-
- name: Restore dependencies
27-
run: dotnet restore --verbosity normal
28-
- name: Run Snyk to check for vulnerabilities
29-
uses: snyk/actions/dotnet@master
30-
env:
31-
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
16+
- uses: actions/checkout@master
17+
- name: Setup .NET
18+
uses: actions/setup-dotnet@v4
19+
with:
20+
dotnet-version: 8.0.x
21+
- name: Restore dependencies
22+
run: dotnet restore algorithm-exercises-csharp.sln
23+
- name: Run Snyk to check for vulnerabilities
24+
uses: snyk/actions/dotnet@master
25+
env:
26+
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}

Dockerfile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,14 @@ FROM mcr.microsoft.com/dotnet/sdk:8.0.204-alpine3.19-amd64 AS base
33
ENV WORKDIR=/app
44
WORKDIR ${WORKDIR}
55

6-
FROM node:20.2.0-alpine3.16 AS lint
6+
FROM node:22.1.0-alpine3.19 AS lint
7+
8+
ENV WORKDIR=/app
9+
WORKDIR ${WORKDIR}
10+
11+
COPY ./docs ${WORKDIR}/docs
12+
RUN apk add --update --no-cache make
13+
RUN npm install -g markdownlint-cli
714

815
ENV WORKDIR=/app
916
WORKDIR ${WORKDIR}

0 commit comments

Comments
 (0)