58 lines
1.5 KiB
YAML
58 lines
1.5 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 }}:${{ forgejo.sha }}
|
|
cache-from: type=registry,ref=${{ env.IMAGE_NAME }}:buildcache
|
|
cache-to: type=registry,ref=${{ env.IMAGE_NAME }}:buildcache,mode=max
|
|
|