Fix workflow to match cloud-api-emulator pattern
- Use gitea.actor instead of github.actor - Use REGISTRY_TOKEN secret - Use direct docker build/push commands - Hardcode image name Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,46 +1,27 @@
|
|||||||
name: Build Container Image
|
name: Build and Push Container
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [main]
|
branches:
|
||||||
workflow_dispatch:
|
- main
|
||||||
|
|
||||||
env:
|
env:
|
||||||
REGISTRY: gitea.anvil.it.com
|
REGISTRY: gitea.anvil.it.com
|
||||||
IMAGE_NAME: ${{ github.repository }}
|
IMAGE: kaffa/vultr-api
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build-amd64:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Login to Registry
|
||||||
uses: docker/setup-buildx-action@v3
|
run: docker login ${{ env.REGISTRY }} -u ${{ gitea.actor }} -p ${{ secrets.REGISTRY_TOKEN }}
|
||||||
|
|
||||||
- name: Login to Gitea Container Registry
|
- name: Build and Push AMD64
|
||||||
uses: docker/login-action@v3
|
run: |
|
||||||
with:
|
docker build -t ${{ env.REGISTRY }}/${{ env.IMAGE }}:amd64 -f server/Dockerfile .
|
||||||
registry: ${{ env.REGISTRY }}
|
docker push ${{ env.REGISTRY }}/${{ env.IMAGE }}:amd64
|
||||||
username: ${{ github.actor }}
|
docker tag ${{ env.REGISTRY }}/${{ env.IMAGE }}:amd64 ${{ env.REGISTRY }}/${{ env.IMAGE }}:latest
|
||||||
password: ${{ secrets.GITEA_TOKEN }}
|
docker push ${{ env.REGISTRY }}/${{ env.IMAGE }}:latest
|
||||||
|
|
||||||
- name: Extract metadata
|
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@v5
|
|
||||||
with:
|
|
||||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
||||||
tags: |
|
|
||||||
type=sha
|
|
||||||
type=raw,value=latest,enable={{is_default_branch}}
|
|
||||||
|
|
||||||
- name: Build and push image for amd64
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: ./server/Dockerfile
|
|
||||||
platforms: linux/amd64
|
|
||||||
push: true
|
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user