Skip to content
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

feat(bats): construction de l'image via GitHub Actions #1

Merged
merged 12 commits into from
Jan 15, 2024
74 changes: 74 additions & 0 deletions .github/workflows/bats.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
---
name: Build bats docker image
run-name: ${{ github.actor }} is building bats

on:
pomverte marked this conversation as resolved.
Show resolved Hide resolved
pull_request:
branches: [ "main" ]
paths:
- 'bats/**'

env:
REGISTRY: ghcr.io
IMAGE_TAG: ${{ github.repository }}/bats:v1.10.0-curl

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write

steps:
- name: Checkout repository
uses: actions/[email protected]

- name: Log into registry ${{ env.REGISTRY }}
uses: docker/[email protected]
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/[email protected]
with:
context: bats
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_TAG }}

scan:
runs-on: ubuntu-latest
permissions:
contents: read
packages: read
needs: build
steps:
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: ${{ env.REGISTRY }}/${{ env.IMAGE_TAG }}
format: 'table'
exit-code: '1'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'
env:
TRIVY_USERNAME: ${{ github.actor }}
TRIVY_PASSWORD: ${{ secrets.GITHUB_TOKEN }}

check:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: docker/[email protected]
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Dockerfile linting
uses: hadolint/[email protected]
with:
dockerfile: bats/Dockerfile
ignore: DL3018
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# Formation-DKADM
# Docker images
4 changes: 4 additions & 0 deletions bats/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM bats/bats:v1.10.0

RUN apk update && apk upgrade --no-cache && \
apk add --no-cache curl
5 changes: 5 additions & 0 deletions bats/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# BATS

## Pourquoi

L'image précédemment utilisée `dduportal/bats:0.4.0` n'est plus disponible sur Docker Hub.
josephpage marked this conversation as resolved.
Show resolved Hide resolved