Skip to content

Commit

Permalink
[CI] Fix Docker pipelines (#182)
Browse files Browse the repository at this point in the history
  • Loading branch information
marco-lancini authored Feb 16, 2024
1 parent 5035598 commit 1d7f906
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 36 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/docker_ansible_worker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,12 @@ on:
branches:
- main
paths:
- 'docker/ansible-worker/Dockerfile'
- 'docker/ansible-worker/VERSION'
- 'docker/ansible-worker/**/*'
pull_request:
branches:
- main
paths:
- 'docker/ansible-worker/Dockerfile'
- 'docker/ansible-worker/VERSION'
- 'docker/ansible-worker/**/*'

jobs:
run-docker:
Expand All @@ -28,7 +26,7 @@ jobs:

uses: marco-lancini/utils/.github/workflows/reusable-docker.yml@main
with:
FOLDER: ${{ github.workspace }}/docker/ansible-worker
FOLDER: 'docker/ansible-worker'
REGISTRY: ghcr.io/${{ github.repository_owner }}
IMAGE_NAME: ansible-worker
secrets:
Expand Down
10 changes: 3 additions & 7 deletions .github/workflows/docker_github_changelog_generator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,12 @@ on:
branches:
- main
paths:
- 'docker/github-changelog-generator/Dockerfile'
- 'docker/github-changelog-generator/Gemfile'
- 'docker/github-changelog-generator/VERSION'
- 'docker/github-changelog-generator/**/*'
pull_request:
branches:
- main
paths:
- 'docker/github-changelog-generator/Dockerfile'
- 'docker/github-changelog-generator/Gemfile'
- 'docker/github-changelog-generator/VERSION'
- 'docker/github-changelog-generator/**/*'

jobs:
run-docker:
Expand All @@ -30,7 +26,7 @@ jobs:

uses: marco-lancini/utils/.github/workflows/reusable-docker.yml@main
with:
FOLDER: ${{ github.workspace }}/docker/github-changelog-generator
FOLDER: 'docker/github-changelog-generator'
REGISTRY: ghcr.io/${{ github.repository_owner }}
IMAGE_NAME: github-changelog-generator
secrets:
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/docker_latex.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,12 @@ on:
branches:
- main
paths:
- 'docker/latex/Dockerfile'
- 'docker/latex/VERSION'
- 'docker/latex/**/*'
pull_request:
branches:
- main
paths:
- 'docker/latex/Dockerfile'
- 'docker/latex/VERSION'
- 'docker/latex/**/*'

jobs:
run-docker:
Expand All @@ -28,7 +26,7 @@ jobs:

uses: marco-lancini/utils/.github/workflows/reusable-docker.yml@main
with:
FOLDER: ${{ github.workspace }}/docker/latex
FOLDER: 'docker/latex'
REGISTRY: ghcr.io/${{ github.repository_owner }}
IMAGE_NAME: latex
secrets:
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/docker_markserv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,12 @@ on:
branches:
- main
paths:
- 'docker/markserv/Dockerfile'
- 'docker/markserv/VERSION'
- 'docker/markserv/**/*'
pull_request:
branches:
- main
paths:
- 'docker/markserv/Dockerfile'
- 'docker/markserv/VERSION'
- 'docker/markserv/**/*'

jobs:
run-docker:
Expand All @@ -28,7 +26,7 @@ jobs:

uses: marco-lancini/utils/.github/workflows/reusable-docker.yml@main
with:
FOLDER: ${{ github.workspace }}/docker/markserv
FOLDER: 'docker/markserv'
REGISTRY: ghcr.io/${{ github.repository_owner }}
IMAGE_NAME: markserv
secrets:
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/docker_nomad.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,12 @@ on:
branches:
- main
paths:
- 'docker/nomad/Dockerfile'
- 'docker/nomad/VERSION'
- 'docker/nomad/**/*'
pull_request:
branches:
- main
paths:
- 'docker/nomad/Dockerfile'
- 'docker/nomad/VERSION'
- 'docker/nomad/**/*'

jobs:
run-docker:
Expand All @@ -28,7 +26,7 @@ jobs:

uses: marco-lancini/utils/.github/workflows/reusable-docker.yml@main
with:
FOLDER: ${{ github.workspace }}/docker/nomad
FOLDER: 'docker/nomad'
REGISTRY: ghcr.io/${{ github.repository_owner }}
IMAGE_NAME: nomad
secrets:
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/docker_pandoc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@ on:
branches:
- main
paths:
- 'docker/pandoc/Dockerfile'
- 'docker/pandoc/VERSION'
- 'docker/pandoc/**/*'
pull_request:
branches:
- main
paths:
- 'docker/pandoc/Dockerfile'
- 'docker/pandoc/VERSION'
- 'docker/pandoc/**/*'

jobs:
run-docker:
Expand All @@ -24,7 +22,7 @@ jobs:

uses: marco-lancini/utils/.github/workflows/reusable-docker.yml@main
with:
FOLDER: ${{ github.workspace }}/docker/pandoc
FOLDER: 'docker/pandoc'
REGISTRY: ghcr.io/${{ github.repository_owner }}
IMAGE_NAME: pandoc
secrets:
Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/reusable-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
FOLDER:
required: true
type: string
DOCKERFILE_NAME:
required: false
type: string
default: 'Dockerfile'
REGISTRY:
required: true
type: string
Expand Down Expand Up @@ -40,7 +44,7 @@ jobs:

steps:
- name: 📂 Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v4.1.1

# ========================================================================
# Install Tooling
Expand Down Expand Up @@ -70,7 +74,7 @@ jobs:
uses: docker/build-push-action@master
with:
push: false
file: ${{ inputs.FOLDER }}/Dockerfile
file: ${{ inputs.FOLDER }}/${{ inputs.DOCKERFILE_NAME }}
tags: ${{ inputs.IMAGE_NAME }}:${{ inputs.IMAGE_TAG }}
# Needed for trivy
outputs: type=docker
Expand Down Expand Up @@ -128,7 +132,7 @@ jobs:
})
# ========================================================================
# Build Image and push to GCR (except on PR)
# Build Image and push to GHCR (except on PR)
# ========================================================================
# Extract metadata (tags, labels) for Docker
- name: 📭 Extract Docker metadata
Expand All @@ -145,7 +149,7 @@ jobs:
uses: docker/build-push-action@master
with:
push: ${{ github.event_name != 'pull_request' }}
file: ${{ inputs.FOLDER }}/Dockerfile
file: ${{ inputs.FOLDER }}/${{ inputs.DOCKERFILE_NAME }}
labels: ${{ steps.meta.outputs.labels }}
# Use tags: ${{ steps.meta.outputs.tags }} if you want to tag the image with branch name
tags: ${{ inputs.REGISTRY }}/${{ inputs.IMAGE_NAME }}:${{ inputs.IMAGE_TAG }}

0 comments on commit 1d7f906

Please sign in to comment.