go-guess/.github/workflows/publish-image.yml
2026-10-03 01:31:06 +02:00

57 lines
1.4 KiB
YAML

name: Publish Docker image
on:
push:
branches:
- master
workflow_dispatch:
permissions:
contents: read
env:
IMAGE_NAME: batty1039.startdedicated.net:5000/go-guess
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
publish-image:
name: Build and push Docker image
runs-on: ubuntu-latest
steps:
- name: Check out source
uses: actions/checkout@v4
- name: Configure HTTP registry
run: |
cat > /tmp/buildkitd.toml <<'EOF'
[registry."batty1039.startdedicated.net:5000"]
http = true
insecure = true
EOF
- name: Log in to private registry
uses: docker/login-action@v3
with:
registry: batty1039.startdedicated.net:5000
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
buildkitd-config: /tmp/buildkitd.toml
driver-opts: |
image=moby/buildkit:master
- name: Build and push image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: true
tags: |
${{ env.IMAGE_NAME }}:latest
${{ env.IMAGE_NAME }}:${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max