Dockerfile Builder #5013
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: Dockerfile Builder | |
on: | |
# We need to run this workflow after NPM publisher otherwise Docker is going to try to create | |
# images with NPM packages (versions) that do not exist in the registry yet. | |
# See: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflow_run | |
workflow_run: | |
workflows: ['NPM Publisher'] | |
branches: | |
- master | |
types: | |
- completed | |
env: | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
jobs: | |
# https://docs.docker.com/ci-cd/github-actions/ | |
build-and-publish: | |
runs-on: ubuntu-latest | |
if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
strategy: | |
fail-fast: false | |
matrix: | |
project: | |
- 'abacus' | |
- 'abacus-backoffice' | |
- 'abacus-kochka' | |
- 'abacus-tools' | |
- 'mrtnzlml-meta' | |
include: | |
- project: abacus | |
projectPath: './src/abacus' | |
projectDockerfile: './src/abacus/Dockerfile' | |
projectImageName: 'adeira/abacus' | |
- project: abacus-backoffice | |
projectPath: './src/abacus-backoffice' | |
projectDockerfile: './src/abacus-backoffice/Dockerfile' | |
projectImageName: 'adeira/abacus-backoffice' | |
- project: abacus-kochka | |
projectPath: './src/abacus-kochka' | |
projectDockerfile: './src/abacus-kochka/Dockerfile' | |
projectImageName: 'adeira/abacus-kochka' | |
- project: abacus-tools | |
projectPath: './src/abacus-tools' | |
projectDockerfile: './src/abacus-tools/Dockerfile' | |
projectImageName: 'adeira/abacus-tools' | |
- project: mrtnzlml-meta | |
projectPath: './src/mrtnzlml-meta' | |
projectDockerfile: './src/mrtnzlml-meta/Dockerfile' | |
projectImageName: 'adeira/mrtnzlml-meta' | |
steps: | |
# https://github.com/actions/checkout | |
- uses: actions/checkout@v4.2.1 | |
with: | |
# Number of commits to fetch. 0 indicates all history for all branches and tags. | |
fetch-depth: 0 | |
# https://github.com/docker/login-action | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3.3.0 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
# https://github.com/docker/setup-buildx-action | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3.7.0 | |
# https://github.com/docker/metadata-action | |
- name: Collect Docker metadata | |
id: meta | |
uses: docker/metadata-action@v5.5.1 | |
with: | |
images: ${{ matrix.projectImageName }} | |
flavor: | | |
latest=true | |
tags: | | |
type=sha | |
# https://github.com/docker/build-push-action | |
- name: Build and push | |
id: docker_build | |
uses: docker/build-push-action@v6.9.0 | |
with: | |
context: ${{ matrix.projectPath }} | |
file: ${{ matrix.projectDockerfile }} | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
secrets: | | |
SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }} | |
- name: Image digest | |
run: echo ${{ steps.docker_build.outputs.digest }} |