Fix: #4. Skip baseimage args from checks. #17
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI Test and Publish Workflow | |
on: | |
push: | |
branches: [main] | |
paths-ignore: | |
- '**/*.md' | |
- '**/*.txt' | |
- 'docs/*' | |
# This re-includes the requirements file | |
# while not touching any other previously | |
# excluded .txt files. For more information, | |
# see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet | |
- '!requirements.txt' | |
- '!requirements-dev.txt' | |
pull_request: | |
branches: [main] | |
paths-ignore: | |
- '**/*.md' | |
- '**/*.txt' | |
- 'docs/*' | |
- '!requirements.txt' | |
- '!requirements-dev.txt' | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
DOCKER_BUILDKIT: "1" | |
TERM: linux | |
jobs: | |
test: | |
strategy: | |
matrix: | |
version: [py310] | |
flavor: [debian, spacy] | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build | |
run: | | |
export PYTHON_VERSION=${{ matrix.version }} | |
export DOCKER_BUILDKIT=1 | |
docker buildx ls | |
docker-compose build --pull --force-rm ${{ matrix.flavor }} | |
docker-compose run --rm ${{ matrix.flavor }}-test | |
- name: Cleanup | |
run: | | |
docker-compose down -v && docker-compose rm --force | |
security: | |
strategy: | |
matrix: | |
version: [py310] | |
flavor: [debian, spacy] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: docker-security | |
uses: instrumenta/conftest-action@master | |
with: | |
files: ${{ matrix.version }}-${{ matrix.flavor }}.dockerfile | |
policy: .docker-security.rego | |
publish: | |
strategy: | |
matrix: | |
version: [py310] | |
flavor: [debian, spacy] | |
runs-on: ubuntu-latest | |
if: github.event_name != 'pull_request' | |
permissions: | |
contents: read | |
packages: write | |
needs: | |
- security | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Log in to the Github Container registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract branch name | |
shell: bash | |
run: echo "branch=${GITHUB_REF##*/}" >> $GITHUB_OUTPUT | |
id: extract_branch | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v3 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
labels: | | |
maintainer=robipolli@gmail.com | |
org.opencontainers.image.source.branch=${{ steps.extract_branch.outputs.branch }} | |
tags: | | |
type=raw,value=${{ matrix.version }}-${{ matrix.flavor }}-{{date 'YYYYMMDD'}}-${{github.run_number}}-{{sha}} | |
type=raw,value=${{ matrix.version }}-${{ matrix.flavor }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
# no-cache: true | |
sbom: true | |
ulimit: nofile=2048:2048 | |
file: ${{ matrix.version }}-${{ matrix.flavor }}.dockerfile | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |