Docker Image CI for dev #761
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: Docker Image CI for dev | |
on: | |
# Controls when the workflow will run | |
schedule: | |
- cron: '35 2 * * *' | |
push: | |
branches: [ dev ] | |
# permissions are needed if pushing to ghcr.io | |
permissions: | |
packages: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
# Get the repository's code | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: dev | |
# https://github.com/docker/setup-qemu-action | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
# https://github.com/docker/setup-buildx-action | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Cache Docker layers | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/.buildx-cache | |
# Key is named differently to avoid collision | |
key: ${{ runner.os }}-multi-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-multi-buildx | |
# Push to Docker Hub | |
- name: Login to Docker Hub | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Docker meta | |
id: guac | |
uses: docker/metadata-action@v5 | |
with: | |
# list of Docker images to use as base name for tags | |
images: | | |
flcontainers/guacamole | |
# Docker tags based on the following events/attributes | |
tags: | | |
type=schedule,pattern=testing | |
type=raw,value=testing | |
flavor: | | |
latest=false | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64/v8,linux/ppc64le | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.guac.outputs.tags }} | |
labels: ${{ steps.guac.outputs.labels }} | |
cache-from: type=local,src=/tmp/.buildx-cache | |
# Note the mode=max here | |
# More: https://github.com/moby/buildkit#--export-cache-options | |
# And: https://github.com/docker/buildx#--cache-tonametypetypekeyvalue | |
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new | |
- name: Move cache | |
run: | | |
rm -rf /tmp/.buildx-cache | |
mv /tmp/.buildx-cache-new /tmp/.buildx-cache |