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: diff --git a/Dockerfile b/Dockerfile index 834e783..3bdcbc2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,14 +5,7 @@ ENV WORKDIR=/app WORKDIR ${WORKDIR} ############################################################################### -FROM node:22.2.0-alpine3.19 AS lint - -ENV WORKDIR=/app -WORKDIR ${WORKDIR} - -COPY ./docs ${WORKDIR}/docs -RUN apk add --update --no-cache make -RUN npm install -g markdownlint-cli +FROM node:20.14.0-alpine3.20 AS mdlint ENV WORKDIR=/app WORKDIR ${WORKDIR} 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