Skip to content
This repository has been archived by the owner on Jul 26, 2023. It is now read-only.

Docker image

Docker image #271

Workflow file for this run

---
name: Docker image
on:
# push & pull_request might duplicate the workflow, but this is acceptable for now
push:
pull_request:
schedule:
# Rebuild weekly
- cron: '0 0 * * 0'
workflow_dispatch:
permissions:
contents: read
packages: write
jobs:
build-container:
name: Docker Image
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
with:
persist-credentials: false
submodules: true
- name: Setup Cache for Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx
- name: Set up QEMU for Multi Arch builds
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx for Multi Arch builds and Caching
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
if: ${{ github.event_name == 'schedule' || github.event.repository.default_branch == github.ref_name }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4.6.0
with:
images: "ghcr.io/${{ github.repository }}"
- name: Build Docker image & push on main branch
uses: docker/build-push-action@v4
with:
context: ./
push: ${{ github.event_name == 'schedule' || github.event.repository.default_branch == github.ref_name }}
platforms: linux/amd64,linux/arm/v7,linux/arm64/v8
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache