Skip to content

Develop #64

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 25 additions & 25 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
9 changes: 1 addition & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
7 changes: 3 additions & 4 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand All @@ -34,7 +34,6 @@ services:
volumes:
- ./:/app
profiles: ["development"]

## REFERENCES:
## (1) Passing Environment variable with fallback value:
## https://stackoverflow.com/a/70772707/6366150
Expand Down