Skip to content

Build Docker Image

Build Docker Image #12

Workflow file for this run

name: Build Docker Image
on:
workflow_run:
workflows: ["Run server tests with pytest"]
types:
- completed
workflow_dispatch:
inputs:
push_to_registry:
description: 'Push image to GHCR'
required: true
default: true
type: boolean
jobs:
build:
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
file: ./docker/Dockerfile
context: .
push: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.push_to_registry == 'true' || github.event_name == 'workflow_run' }}
tags: |
ghcr.io/${{ github.repository_owner }}/simpletool-server:latest
ghcr.io/${{ github.repository_owner }}/simpletool-server:${{ github.ref_name }}
- name: Image built
run: echo "Docker image build completed"