ci: add Gitea Actions workflow to build and publish multi-arch image
Build and Publish Image / build (push) Failing after 6m20s
Build and Publish Image / build (push) Failing after 6m20s
Builds linux/amd64+arm64 from source and pushes to the built-in Gitea container registry (git.qomar.pw/omar/ds2api) on push to main and tags. Adds --platform=$BUILDPLATFORM to the node/go builder stages so arm64 cross-compiles on the amd64 runner instead of slow QEMU emulation.
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
name: Build and Publish Image
|
||||
|
||||
# Собирает Docker-образ из исходника и пушит в встроенный registry Gitea (Packages).
|
||||
# Образ: git.qomar.pw/omar/ds2api
|
||||
# Триггеры: push в main, любой тег vX.Y.Z, и ручной запуск.
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
tags:
|
||||
- 'v*'
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
REGISTRY: git.qomar.pw
|
||||
# github.repository в Gitea = "omar/ds2api" (уже в нижнем регистре)
|
||||
IMAGE: git.qomar.pw/${{ github.repository }}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to Gitea registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
# actor — пользователь, запустивший workflow (omar); GITEA_TOKEN выдаётся автоматически
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITEA_TOKEN }}
|
||||
|
||||
- name: Extract metadata (tags, labels)
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ env.IMAGE }}
|
||||
tags: |
|
||||
type=ref,event=branch
|
||||
type=ref,event=tag
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=sha,prefix=sha-
|
||||
type=raw,value=latest,enable={{is_default_branch}}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v6
|
||||
env:
|
||||
DOCKER_BUILD_RECORD_UPLOAD: "false"
|
||||
DOCKER_BUILD_SUMMARY: "false"
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
build-args: |
|
||||
BUILD_VERSION=${{ github.ref_name }}
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
FROM node:24 AS webui-builder
|
||||
FROM --platform=$BUILDPLATFORM node:24 AS webui-builder
|
||||
|
||||
WORKDIR /app/webui
|
||||
COPY webui/package.json webui/package-lock.json ./
|
||||
@@ -7,7 +7,7 @@ COPY config.example.json /app/config.example.json
|
||||
COPY webui ./
|
||||
RUN npm run build
|
||||
|
||||
FROM golang:1.26 AS go-builder
|
||||
FROM --platform=$BUILDPLATFORM golang:1.26 AS go-builder
|
||||
WORKDIR /app
|
||||
ARG TARGETOS
|
||||
ARG TARGETARCH
|
||||
|
||||
Reference in New Issue
Block a user