feat: use BuildKit docker-container driver
This commit is contained in:
66
.gitea/workflows/build-platform-api.yaml
Normal file
66
.gitea/workflows/build-platform-api.yaml
Normal file
@@ -0,0 +1,66 @@
|
||||
name: Build & Push Platform API
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- 'services/platform-api/**'
|
||||
branches: [main]
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
REGISTRY: gitea.platform.dlytica.com
|
||||
IMAGE: gitea_admin/platform-api
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx (BuildKit)
|
||||
uses: docker/setup-buildx-action@v3
|
||||
with:
|
||||
# Use the BuildKit daemon deployed in the cluster as a remote builder
|
||||
# Falls back to the local BuildKit instance in the runner environment
|
||||
driver: docker-container
|
||||
driver-opts: |
|
||||
image=moby/buildkit:latest
|
||||
network=host
|
||||
|
||||
- name: Login to Gitea Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: gitea_admin
|
||||
password: ${{ secrets.GITEA_REGISTRY_PASSWORD }}
|
||||
|
||||
- name: Extract metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE }}
|
||||
tags: |
|
||||
type=sha,prefix=sha-,format=short
|
||||
type=raw,value=latest,enable={{is_default_branch}}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: services/platform-api
|
||||
file: services/platform-api/Dockerfile
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE }}:buildcache
|
||||
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE }}:buildcache,mode=max
|
||||
provenance: false
|
||||
sbom: false
|
||||
|
||||
- name: Rollout restart
|
||||
if: success()
|
||||
run: |
|
||||
curl -s -X POST \
|
||||
-H "Authorization: token ${{ secrets.GITEA_REGISTRY_PASSWORD }}" \
|
||||
"${{ env.REGISTRY }}/api/v1/repos/gitea_admin/platform-api/tags" || true
|
||||
echo "Image pushed: ${{ steps.meta.outputs.tags }}"
|
||||
Reference in New Issue
Block a user