Skip to content

v0.75.0

v0.75.0 #420

name: Build App component image
on:
release:
types: [ published ]
workflow_dispatch:
inputs:
tag:
description: Image tag
required: true
jobs:
build:
runs-on: ubuntu-latest
# see https://github.com/docker/build-push-action
steps:
# Setup (see https://github.com/docker/build-push-action)
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# Publish to Docker hub
- name: Store version number (on release)
if: ${{ github.event_name == 'release' }}
id: version
# GITHUB_REF looks like "refs/tags/0.3.1" - we need to extract the actual version without the v prefix
run: echo "number=${GITHUB_REF##*/}" >> $GITHUB_OUTPUT
# Caches
- name: Cache
id: cache
uses: actions/cache@v4
with:
path: |
var-cache-apt
var-lib-apt
root-.cache
key: cache-${{ hashFiles('Dockerfile') }}
- name: inject cache into docker
uses: reproducible-containers/buildkit-cache-dance@v3.1.2
with:
cache-map: |
{
"var-cache-apt": "/var/cache/apt",
"var-lib-apt": "/var/lib/apt",
"root-.cache": "/root/.cache"
}
skip-extraction: ${{ steps.cache.outputs.cache-hit }}
# Release push (with a tag)
- name: Build and push (on release)
if: ${{ github.event_name == 'release' }}
uses: docker/build-push-action@v6
with:
push: true
context: .
target: app
file: Dockerfile
build-args: |
DJANGO_SETTINGS_MODULE=config.settings.dev
cache-from: type=registry,ref=blsq/openhexa-app:buildcache
cache-to: type=registry,ref=blsq/openhexa-app:buildcache,mode=max
tags: |
blsq/openhexa-app:${{ steps.version.outputs.number }}
# Manual push
- name: Build and push (manual)
if: ${{ github.event_name == 'workflow_dispatch' }}
uses: docker/build-push-action@v6
with:
push: true
context: .
target: app
file: Dockerfile
build-args: |
DJANGO_SETTINGS_MODULE=config.settings.dev
cache-from: type=registry,ref=blsq/openhexa-app:buildcache
cache-to: type=registry,ref=blsq/openhexa-app:buildcache,mode=max
tags: |
blsq/openhexa-app:${{ github.event.inputs.tag }}