Skip to content

Docker Image CI

Docker Image CI #8

Workflow file for this run

name: "Docker Image CI"
on:
push:
pull_request:
workflow_dispatch:
inputs:
release:
type: boolean
description: "Release the built Docker image into 'ghcr.io'"
jobs:
build:
name: "Build ${{ github.event_name == 'workflow_dispatch' && inputs.release && 'and Deploy' || '' }} Docker Image"
env:
RUNS_ON: "ubuntu-20.04"
permissions:
packages: write
runs-on: "ubuntu-20.04"
steps:
- name: "Build Docker Image"
uses: docker/build-push-action@v5
with:
load: true
tags: "distcc-docker:${{ env.RUNS_ON }}"
- name: "Simple test"
run: |
docker run \
--init \
--rm \
"distcc-docker:${{ env.RUNS_ON }}" \
--jobs $(nproc) \
-- \
bash -c \
"ps fauxw; /usr/bin/ls -alh .; /usr/bin/ls -alh /var/log; cat /var/log/*; exit;"
- name: "Log in to GitHub Container Registry (GHCR)"
if: "github.ref == 'refs/heads/master' && github.event_name == 'workflow_dispatch' && inputs.release"
uses: docker/login-action@v3
with:
registry: "ghcr.io"
username: "${{ github.actor }}"
password: "${{ secrets.GITHUB_TOKEN }}"
- name: "Upload image to GHCR"
if: "github.ref == 'refs/heads/master' && github.event_name == 'workflow_dispatch' && inputs.release"
uses: docker/build-push-action@v5
with:
push: true
tags: "distcc-docker:${{ env.RUNS_ON }}"