Skip to content

Docker (factory)

Docker (factory) #136

name: Docker (factory)
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
on:
workflow_dispatch:
inputs:
klipperVer:
description: Klipper Version
type: string
required: true
klipperRepo:
description: Klipper repo to use
type: choice
options:
- https://github.com/Klipper3d/klipper.git
- https://github.com/Laikulo/klipper.git
tagName:
description: Tag to create
type: string
required: true
env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}/factory
jobs:
build_factory:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
name: Checkout
with:
submodules: true
- name: Setup buildx
uses: docker/setup-buildx-action@v3
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images:
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: ${{ inputs.tagName }}
- name: Docker Build
uses: docker/build-push-action@v5
with:
context: ./factory-container
file: ./factory-container/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.meta.outputs.tags }}
build-args: |
klipper_repo=${{ inputs.klipperRepo }}
klipper_ref=${{ inputs.klipperVer }}
cache-from: type=gha
cache-to: type=gha,mode=max