feat: add production container publishing
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
parent
06b16064f8
commit
fa4091a673
6 changed files with 218 additions and 0 deletions
59
.github/workflows/publish-image.yml
vendored
Normal file
59
.github/workflows/publish-image.yml
vendored
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
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@v5
|
||||
|
||||
- name: Configure HTTP registry
|
||||
run: |
|
||||
sudo mkdir -p /etc/docker
|
||||
echo '{"insecure-registries":["batty1039.startdedicated.net:5000"]}' | \
|
||||
sudo tee /etc/docker/daemon.json >/dev/null
|
||||
sudo systemctl restart docker
|
||||
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@v4
|
||||
with:
|
||||
registry: batty1039.startdedicated.net:5000
|
||||
username: ${{ secrets.REGISTRY_USERNAME }}
|
||||
password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v4
|
||||
with:
|
||||
buildkitd-config: /tmp/buildkitd.toml
|
||||
|
||||
- name: Build and push image
|
||||
uses: docker/build-push-action@v7
|
||||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue