Skip to content

Docker

Docker #52

Workflow file for this run

name: Docker
on:
workflow_call:
inputs:
push:
required: true
type: boolean
workflow_dispatch:
inputs:
push:
required: true
type: boolean
default: true
permissions:
contents: read
packages: write
env:
IMAGE_AUTHOR: mentalfs
IMAGE_NAME: boinc-client
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v3
- name: Log into registry
if: ${{ inputs.push }}
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Delete older image versions
if: ${{ inputs.push }}
uses: actions/delete-package-versions@v5
with:
package-name: ${{ env.IMAGE_NAME }}
package-type: container
delete-only-untagged-versions: true
token: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ env.IMAGE_AUTHOR }}/${{ env.IMAGE_NAME }}
- name: Build RELEASE Docker image and push it
id: build-and-push-release
uses: docker/build-push-action@v5
with:
context: .
build-args: BOINC_REPO=stable
tags: |
ghcr.io/${{ env.IMAGE_AUTHOR }}/${{ env.IMAGE_NAME }}:release
ghcr.io/${{ env.IMAGE_AUTHOR }}/${{ env.IMAGE_NAME }}:latest
labels: ${{ steps.meta.outputs.labels }}
provenance: false
push: ${{ inputs.push }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build ALPHA Docker image and push it
id: build-and-push-alpha
uses: docker/build-push-action@v5
with:
context: .
build-args: BOINC_REPO=alpha
tags: ghcr.io/${{ env.IMAGE_AUTHOR }}/${{ env.IMAGE_NAME }}:alpha
labels: ${{ steps.meta.outputs.labels }}
provenance: false
push: ${{ inputs.push }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build DEBIAN Docker image and push it
id: build-and-push-debian
uses: docker/build-push-action@v5
with:
context: .
build-args: BOINC_REPO=
tags: ghcr.io/${{ env.IMAGE_AUTHOR }}/${{ env.IMAGE_NAME }}:debian
labels: ${{ steps.meta.outputs.labels }}
provenance: false
push: ${{ inputs.push }}
cache-from: type=gha
cache-to: type=gha,mode=max