fix ERROR: failed to build (#546)

* feat: GHA push2master

* fix Dockerfile

* убран docker hub
This commit is contained in:
Vyacheslav Scherbinin
2025-07-17 07:24:58 +07:00
committed by GitHub
parent 6669ed2a72
commit 559c94b618
2 changed files with 55 additions and 3 deletions

52
.github/workflows/docker_image.yml vendored Normal file
View File

@@ -0,0 +1,52 @@
name: Release Docker multi arch
on:
push:
branches:
- master
jobs:
docker:
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: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: set lower case owner name
run: |
echo "REG_REPO=${REPO,,}" >>${GITHUB_ENV}
env:
REPO: '${{ github.repository }}'
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ env.REG_REPO }}
tags: |
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'master') }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha,scope=${{ github.workflow }}
cache-to: type=gha,mode=max,scope=${{ github.workflow }}

View File

@@ -39,16 +39,16 @@ RUN apk add --update g++ \
&& cd server \
&& go mod tidy \
&& go clean -i -r -cache \
&& go build -ldflags '-w -s' --o "torrserver" ./cmd
&& go build -ldflags '-w -s' --o "torrserver" ./cmd
### BUILD TORRSERVER MULTIARCH END ###
### UPX COMPRESSING START ###
FROM debian:buster-slim AS compressed
FROM ubuntu AS compressed
COPY --from=builder /opt/src/server/torrserver ./torrserver
RUN apt-get update && apt-get install -y upx-ucl && upx --best --lzma ./torrserver
RUN apt update && apt install -y upx-ucl && upx --best --lzma ./torrserver
# Compress torrserver only for amd64 and arm64 no variant platforms
# ARG TARGETARCH
# ARG TARGETVARIANT