Skip to content

Docker Build and Publish #69

Docker Build and Publish

Docker Build and Publish #69

name: Docker Build and Publish
on:
push:
branches:
- main
tags-ignore:
- '**'
release:
types: [published]
schedule:
- cron: '0 0 14,28 * *'
workflow_dispatch:
jobs:
build:
name: Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check Out Repository Files
uses: actions/checkout@v3
- name: Set Up Runner
uses: './.github/workflows/composite-actions/setup'
- name: Set Image Tags
id: tags
run: |
if [[ "${{ github.event_name}}" == "release" ]]; then
echo "TAG_BASE_STANDARD=${{ env.TAG_BASE_STANDARD }}-${{ github.ref_name }}" >> $GITHUB_OUTPUT
echo "TAG_BASE_ROOT=${{ env.TAG_BASE_ROOT }}-${{ github.ref_name }}" >> $GITHUB_OUTPUT
echo "TAG_FULL_STANDARD=${{ env.TAG_FULL_STANDARD }}-${{ github.ref_name }}" >> $GITHUB_OUTPUT
echo "TAG_FULL_ROOT=${{ env.TAG_FULL_ROOT }}-${{ github.ref_name }}" >> $GITHUB_OUTPUT
else
echo "TAG_BASE_STANDARD=${{ env.TAG_BASE_STANDARD }}" >> $GITHUB_OUTPUT
echo "TAG_BASE_ROOT=${{ env.TAG_BASE_ROOT }}" >> $GITHUB_OUTPUT
echo "TAG_FULL_STANDARD=${{ env.TAG_FULL_STANDARD }}" >> $GITHUB_OUTPUT
echo "TAG_FULL_ROOT=${{ env.TAG_FULL_ROOT }}" >> $GITHUB_OUTPUT
fi
- name: Publish Docker Image - base - standard
if: ${{ always() }}
uses: './.github/workflows/composite-actions/test-publish'
with:
user: standard
docker_build_context: dockerfile_base/
publish_repo: ${{ env.DOCKER_HUB_REPO }}
publish_tag: ${{ steps.tags.outputs.TAG_BASE_STANDARD }}
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
DOCKER_HUB_ACCESS_TOKEN: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Publish Docker Image - base - root
if: ${{ always() }}
uses: './.github/workflows/composite-actions/test-publish'
with:
user: root
docker_build_context: dockerfile_base/
publish_repo: ${{ env.DOCKER_HUB_REPO }}
publish_tag: ${{ steps.tags.outputs.TAG_BASE_ROOT }}
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
DOCKER_HUB_ACCESS_TOKEN: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Build Image - base/root (full image dependency)
if: ${{ github.event_name == 'release' }}
uses: './.github/workflows/composite-actions/docker-build-push'
with:
user: root
context: dockerfile_base/
load: 'true'
push: 'false'
tags: ${{ env.DOCKER_HUB_REPO }}:${{ env.TAG_BASE_ROOT }}
- name: Publish Docker Image - full - standard
if: ${{ always() }}
uses: './.github/workflows/composite-actions/test-publish'
with:
user: standard
docker_build_context: dockerfile_full/
publish_repo: ${{ env.DOCKER_HUB_REPO }}
publish_tag: ${{ steps.tags.outputs.TAG_FULL_STANDARD }}
required_images: ${{ env.DOCKER_HUB_REPO }}:${{ env.TAG_BASE_ROOT }}
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
DOCKER_HUB_ACCESS_TOKEN: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Publish Docker Image - full - root
if: ${{ always() }}
uses: './.github/workflows/composite-actions/test-publish'
with:
user: root
docker_build_context: dockerfile_full/
publish_repo: ${{ env.DOCKER_HUB_REPO }}
publish_tag: ${{ steps.tags.outputs.TAG_FULL_ROOT }}
required_images: ${{ env.DOCKER_HUB_REPO }}:${{ env.TAG_BASE_ROOT }}
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
DOCKER_HUB_ACCESS_TOKEN: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}