From dc4f0adca4cff48b77cccf1002479b2ebe62ff1d Mon Sep 17 00:00:00 2001 From: Gonzalo Diaz Date: Sun, 9 Jun 2024 13:43:08 -0400 Subject: [PATCH 1/3] [CONFIG] Docker Alpine-based images updated to Alpine 3.20 --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 834e783..67245b5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ ENV WORKDIR=/app WORKDIR ${WORKDIR} ############################################################################### -FROM node:22.2.0-alpine3.19 AS lint +FROM node:20.14.0-alpine3.20 AS mdlint ENV WORKDIR=/app WORKDIR ${WORKDIR} From 99d390bc4d017d223ba4e50dfbf191f469cf33f6 Mon Sep 17 00:00:00 2001 From: Gonzalo Diaz Date: Sun, 9 Jun 2024 13:43:54 -0400 Subject: [PATCH 2/3] [CONFIG] [Docker] duplicate code removed. Markdown lint image and service, renamed. --- Dockerfile | 7 ------- compose.yaml | 7 +++---- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index 67245b5..3bdcbc2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,13 +10,6 @@ FROM node:20.14.0-alpine3.20 AS mdlint ENV WORKDIR=/app WORKDIR ${WORKDIR} -COPY ./docs ${WORKDIR}/docs -RUN apk add --update --no-cache make -RUN npm install -g markdownlint-cli - -ENV WORKDIR=/app -WORKDIR ${WORKDIR} - COPY ./docs ${WORKDIR}/docs RUN apk add --update --no-cache make RUN npm install -g --ignore-scripts markdownlint-cli diff --git a/compose.yaml b/compose.yaml index 53640eb..40bb81c 100644 --- a/compose.yaml +++ b/compose.yaml @@ -15,10 +15,10 @@ services: image: algorithm-exercises-csharp:mdlint build: context: . - target: lint + target: mdlint # environment: - # LOG_LEVEL: ${LOG_LEVEL:-info} ## (1) ## info | debug - # BRUTEFORCE: ${BRUTEFORCE:-false} ## (1) ## true | false + # LOG_LEVEL: ${LOG_LEVEL:-info} ## (1) ## info | debug + # BRUTEFORCE: ${BRUTEFORCE:-false} ## (1) ## true | false volumes: - ./:/app profiles: ["lint"] @@ -34,7 +34,6 @@ services: volumes: - ./:/app profiles: ["development"] - ## REFERENCES: ## (1) Passing Environment variable with fallback value: ## https://stackoverflow.com/a/70772707/6366150 From 8ee60c9ff093745cc30c21b9b89638744ac437f8 Mon Sep 17 00:00:00 2001 From: Gonzalo Diaz Date: Sun, 9 Jun 2024 13:47:10 -0400 Subject: [PATCH 3/3] [CONFIG] [Docker] [Github-Actions] static check added before running tests. File format: re-indented. --- .github/workflows/docker-image.yml | 50 +++++++++++++++--------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 482de4f..29b55d9 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -1,43 +1,43 @@ name: Docker Image CI - on: push: - branches: [ main, develop, feature/* ] + branches: [main, develop, feature/*] pull_request: - branches: [ main ] + branches: [main] permissions: read-all jobs: - build: name: Build & Test in Docker runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - name: Build the Docker image - run: make compose/rebuild - - name: Run test in Docker image - run: make compose/run - - name: Tag Docker image - run: docker tag algorithm-exercises-csharp:latest algorithm-exercises-csharp:${{ github.sha }} - - - name: Run Snyk to check Docker image for vulnerabilities - # Snyk can be used to break the build when it detects vulnerabilities. - # In this case we want to upload the issues to GitHub Code Scanning - continue-on-error: true - uses: snyk/actions/docker@master - env: - # In order to use the Snyk Action you will need to have a Snyk API token. - # See https://docs.snyk.io/integrations/ci-cd-integrations/github-actions-integration#getting-your-snyk-token - # or you can sign up for free at https://snyk.io/login - SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} - with: - image: algorithm-exercises-csharp:latest - args: --file=Dockerfile + - uses: actions/checkout@v4 + - name: Build the Docker image + run: make compose/rebuild + - name: Run static checks in Docker image + run: make compose/lint + - name: Run test in Docker image + run: make compose/run + - name: Tag Docker image + run: docker tag algorithm-exercises-csharp:latest algorithm-exercises-csharp:${{ github.sha }} + + - name: Run Snyk to check Docker image for vulnerabilities + # Snyk can be used to break the build when it detects vulnerabilities. + # In this case we want to upload the issues to GitHub Code Scanning + continue-on-error: true + uses: snyk/actions/docker@master + env: + # In order to use the Snyk Action you will need to have a Snyk API token. + # See https://docs.snyk.io/integrations/ci-cd-integrations/github-actions-integration#getting-your-snyk-token + # or you can sign up for free at https://snyk.io/login + SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} + with: + image: algorithm-exercises-csharp:latest + args: --file=Dockerfile # - name: Upload result to GitHub Code Scanning # uses: github/codeql-action/upload-sarif@v2 # with: