Inyoka - Build docker images #9
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: Inyoka - Build docker images | |
# how to schedule it manually | |
# https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow | |
on: | |
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#onworkflow_dispatchinputs | |
workflow_dispatch: | |
inputs: | |
branch: | |
description: 'Which branch to build container for' | |
required: true | |
type: choice | |
options: | |
- staging | |
- master | |
- testing | |
env: | |
REGISTRY: git.ubuntu-eu.org | |
jobs: | |
build-and-push-image: | |
runs-on: ubuntu-latest | |
services: | |
registry: | |
image: registry:2 | |
ports: | |
- 5000:5000 | |
steps: | |
- name: Checkout inyoka docker repo | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Checkout inyoka repo | |
uses: actions/checkout@v4 | |
with: | |
repository: inyokaproject/inyoka | |
ref: ${{ inputs.branch }} | |
path: inyoka | |
persist-credentials: false | |
fetch-depth: 0 | |
- name: Checkout theme repo | |
uses: actions/checkout@v4 | |
with: | |
repository: inyokaproject/theme-ubuntuusers | |
ref: ${{ inputs.branch }} | |
path: theme | |
persist-credentials: false | |
fetch-depth: 0 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
# network=host driver-opt needed to push to local registry | |
driver-opts: network=host | |
- name: Get inyoka version string | |
run: echo "INYOKA_VERSION=$(git -C inyoka/ describe --tags)--theme-ubuntuusers$(git -C theme/ describe --tags)" >> $GITHUB_ENV | |
- name: Get inyoka tag (master branch) | |
if: ${{ inputs.branch == 'master' }} | |
run: echo "INYOKA_TAG=latest" >> $GITHUB_ENV | |
- name: Get inyoka tag (other branches) | |
if: ${{ inputs.branch != 'master' }} | |
run: echo "INYOKA_TAG=${{ inputs.branch }}" >> $GITHUB_ENV | |
- name: Log in to own container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ secrets.GITEA_USERNAME }} | |
password: ${{ secrets.GITEA_TOKEN }} | |
- name: Build Inyoka image and push to own container registry | |
uses: docker/build-push-action@v5 | |
id: docker_build_inyoka | |
with: | |
context: . | |
tags: | | |
${{ env.REGISTRY }}/ubuntuusers/inyokaproject:${{ env.INYOKA_VERSION }} | |
${{ env.REGISTRY }}/ubuntuusers/inyokaproject:${{ env.INYOKA_TAG }} | |
localhost:5000/inyokaproject:${{ env.INYOKA_VERSION }} | |
target: inyoka_custom_theme | |
push: true | |
- name: Build customized caddy image and push to own container registry | |
uses: docker/build-push-action@v5 | |
id: docker_build_caddy | |
with: | |
context: . | |
tags: | | |
${{ env.REGISTRY }}/ubuntuusers/caddy-inyoka:${{ env.INYOKA_VERSION }} | |
${{ env.REGISTRY }}/ubuntuusers/caddy-inyoka:${{ env.INYOKA_TAG }} | |
file: Dockerfile_caddy | |
push: true | |
build-contexts: git.ubuntu-eu.org/ubuntuusers/inyokaproject=docker-image://localhost:5000/inyokaproject:${{ env.INYOKA_VERSION }} | |
- name: Image digests | |
run: | | |
echo "Inyoka: ${{ steps.docker_build_inyoka.outputs.digest }}" | |
echo "Caddy: ${{ steps.docker_build_caddy.outputs.digest }}" |