Skip to content

docker

docker #284

Workflow file for this run

---
name: docker
on:
workflow_dispatch:
inputs:
publish_type:
description: 'What type of image the job should publish'
required: false
default: 'release'
type: choice
options:
- release
- beta
schedule:
- cron: '0 1 * * *'
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 100
- name: Configure git
run: |
git config --global user.name "$GITHUB_ACTOR"
git config --global user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: Extract version
run: |
PKG_VERSION=$(cat VERSION | head -1)
echo "PKG_VERSION=$PKG_VERSION" >> $GITHUB_ENV
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
with:
buildkitd-flags: --debug
driver-opts: image=moby/buildkit:latest
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
logout: false
- name: Build and push release image
if: ${{inputs.publish_type == 'release'}}
uses: docker/build-push-action@v3
with:
context: .
file: ./Dockerfile
push: true
tags: "ghcr.io/${{ github.event.repository.owner.login }}/authcrunch:v${{ env.PKG_VERSION }},\
ghcr.io/${{ github.event.repository.owner.login }}/authcrunch:latest"
platforms: linux/amd64,linux/arm64
cache-from: "type=registry,\
ref=ghcr.io/${{ github.event.repository.owner.login }}/authcrunch:latest"
cache-to: type=inline
- name: Build and push beta image
if: ${{ (github.event_name == 'schedule') || (inputs.publish_type == 'beta') }}
uses: docker/build-push-action@v3
with:
context: .
file: ./Dockerfile
push: true
tags: "ghcr.io/${{ github.event.repository.owner.login }}/authcrunch:beta"
platforms: linux/amd64,linux/arm64
cache-from: "type=registry,\
ref=ghcr.io/${{ github.event.repository.owner.login }}/authcrunch:beta"
cache-to: type=inline