Publish Docker images #241
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: Publish Docker images | |
on: | |
release: | |
types: [published] | |
schedule: | |
- cron: '0 0 * * *' # Nightly builds | |
workflow_dispatch: # Manually trigger a workflow run | |
jobs: | |
push_to_registry: | |
name: Push Docker images to Docker Hub | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
image-data: | |
- name: insecure-app | |
image: confusedcrib/insecure-app | |
context: ./insecure-app | |
dockerfile: ./insecure-app/Dockerfile | |
- name: insecure-java | |
image: confusedcrib/insecure-java | |
context: ./insecure-java | |
dockerfile: ./insecure-java/Dockerfile | |
- name: insecure-js | |
image: confusedcrib/insecure-js | |
context: ./insecure-js | |
dockerfile: ./insecure-js/Dockerfile | |
- name: workload-security-evaluator | |
image: confusedcrib/workload-security-evaluator | |
context: ./workload-security-evaluator | |
dockerfile: ./workload-security-evaluator/Dockerfile | |
- name: insecure-api | |
image: confusedcrib/insecure-api | |
context: ./insecure-api | |
dockerfile: ./insecure-api/Dockerfile | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v4 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Extract metadata for ${{ matrix.image-data.name }} | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ matrix.image-data.image }} | |
- name: Build and push ${{ matrix.image-data.name }} Docker image | |
uses: docker/build-push-action@v4 | |
with: | |
context: ${{ matrix.image-data.context }} | |
file: ${{ matrix.image-data.dockerfile }} | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |