3proxy/.github/workflows/docker.yml
Vladimir Dubrovin 9ce5de971f
Some checks are pending
C/C++ CI Linux / ${{ matrix.target }} (ubuntu-24.04-arm) (push) Waiting to run
C/C++ CI Linux / ${{ matrix.target }} (ubuntu-latest) (push) Waiting to run
C/C++ CI MacOS / ${{ matrix.target }} (macos-15) (push) Waiting to run
C/C++ CI Windows / ${{ matrix.target }} (windows-2022) (push) Waiting to run
C/C++ CI cmake / ${{ matrix.target }} (macos-15) (push) Waiting to run
C/C++ CI cmake / ${{ matrix.target }} (ubuntu-24.04-arm) (push) Waiting to run
C/C++ CI cmake / ${{ matrix.target }} (ubuntu-latest) (push) Waiting to run
C/C++ CI cmake / ${{ matrix.target }} (windows-2022) (push) Waiting to run
C/C++ CI cmake / ubuntu-latest (wolfSSL) (push) Waiting to run
Release workflows: a minimal set for a release of the development branch
A release whose tree has DEVEL and no RELEASE is one of the development
branch (release-kind.yml, called by the workflows below). For it only
the Windows x64 zip, the x86_64 and arm64 deb packages and the rpm for
EL 9 and 10 (x86_64 and arm64) are built and added to the release: no
Docker images, no source tarball, no ipk, armhf, watcom, win32 or
Windows arm64 builds. docker.yml makes it a prerelease, not "Latest",
which also keeps it out of the package repository 3proxy.github.io
builds from releases.

The packaging reads the version from RELEASE or DEVEL. rpm names the
source archive and its directory after the spec's Version, which for
2.0.0-devel is 2.0.0~devel, so that %setup finds it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 20:10:59 +03:00

204 lines
5.9 KiB
YAML

name: Build Docker images
on:
release:
types: [published]
workflow_dispatch:
permissions:
contents: read
env:
DOCKERHUB_IMAGE: docker.io/3proxy/3proxy
GHCR_IMAGE: ghcr.io/3proxy/3proxy
jobs:
kind:
permissions:
contents: write
uses: ./.github/workflows/release-kind.yml
with:
mark-prerelease: true
build:
# not for a release of the development branch
needs: kind
if: github.event_name != 'release' || needs.kind.outputs.devel != 'true'
name: ${{ matrix.image }} ${{ matrix.platform }}
permissions:
contents: read
packages: write
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
image: [full, busybox, minimal]
platform: [linux/amd64, linux/arm64, linux/arm/v7]
include:
- platform: linux/amd64
runner: ubuntu-latest
- platform: linux/arm64
runner: ubuntu-24.04-arm
- platform: linux/arm/v7
runner: ubuntu-24.04-arm
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Platform name
id: platform
run: echo "pair=$(echo '${{ matrix.platform }}' | tr / -)" >> "$GITHUB_OUTPUT"
- name: Set up QEMU
if: matrix.platform == 'linux/arm/v7'
uses: docker/setup-qemu-action@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Login to GHCR
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push by digest
id: build
uses: docker/build-push-action@v7
with:
context: .
file: Dockerfile.${{ matrix.image }}
platforms: ${{ matrix.platform }}
provenance: false
sbom: false
outputs: type=image,name=${{ env.GHCR_IMAGE }},push-by-digest=true,name-canonical=true,push=true
- name: Export digest
env:
DIGEST: ${{ steps.build.outputs.digest }}
run: |
mkdir -p /tmp/digests
touch "/tmp/digests/${DIGEST#sha256:}"
- name: Upload digest
uses: actions/upload-artifact@v7
with:
name: digests-${{ matrix.image }}-${{ steps.platform.outputs.pair }}
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1
publish:
name: Publish ${{ matrix.image }}
permissions:
contents: read
packages: write
id-token: write
attestations: write
runs-on: ubuntu-latest
needs: build
strategy:
fail-fast: false
matrix:
include:
- image: full
suffix: ''
floating: latest
- image: busybox
suffix: .busybox
floating: busybox
- image: minimal
suffix: .minimal
floating: minimal
steps:
- name: Download digests
uses: actions/download-artifact@v8
with:
path: /tmp/digests
pattern: digests-${{ matrix.image }}-*
merge-multiple: true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Install cosign
uses: sigstore/cosign-installer@v3
with:
cosign-release: v2.4.3
- name: Login to Docker Hub
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GHCR
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Determine tags
id: tags
env:
RELEASE_TAG: ${{ github.event.release.tag_name }}
SUFFIX: ${{ matrix.suffix }}
FLOATING: ${{ matrix.floating }}
run: |
if [[ "$RELEASE_TAG" != "" ]]; then
RELEASE="${RELEASE_TAG#v}"
echo "versioned=${RELEASE}${SUFFIX}" >> "$GITHUB_OUTPUT"
echo "moving=${FLOATING}" >> "$GITHUB_OUTPUT"
else
DATETIME=$(date +%d%m%y%H%M%S)
BRANCH=$(echo "${GITHUB_REF#refs/heads/}" | tr "/" "-")
echo "versioned=${DATETIME}-${BRANCH}${SUFFIX}" >> "$GITHUB_OUTPUT"
echo "moving=${BRANCH}${SUFFIX}" >> "$GITHUB_OUTPUT"
fi
- name: Create manifest list and push
working-directory: /tmp/digests
env:
VERSIONED: ${{ steps.tags.outputs.versioned }}
MOVING: ${{ steps.tags.outputs.moving }}
run: |
docker buildx imagetools create \
-t "${DOCKERHUB_IMAGE}:${VERSIONED}" \
-t "${DOCKERHUB_IMAGE}:${MOVING}" \
-t "${GHCR_IMAGE}:${VERSIONED}" \
-t "${GHCR_IMAGE}:${MOVING}" \
$(printf "${GHCR_IMAGE}@sha256:%s " *)
- name: Get pushed digest
id: digest
env:
VERSIONED: ${{ steps.tags.outputs.versioned }}
run: |
DIGEST=$(docker buildx imagetools inspect "${DOCKERHUB_IMAGE}:${VERSIONED}" \
--format '{{json .Manifest}}' | jq -r .digest)
echo "digest=${DIGEST}" >> "$GITHUB_OUTPUT"
- name: Attest Docker Hub image
uses: actions/attest-build-provenance@v4
with:
subject-name: ${{ env.DOCKERHUB_IMAGE }}
subject-digest: ${{ steps.digest.outputs.digest }}
push-to-registry: false
- name: Attest GHCR image
uses: actions/attest-build-provenance@v4
with:
subject-name: ${{ env.GHCR_IMAGE }}
subject-digest: ${{ steps.digest.outputs.digest }}
push-to-registry: false
- name: Sign images
env:
DIGEST: ${{ steps.digest.outputs.digest }}
run: |
cosign sign --yes "${DOCKERHUB_IMAGE}@${DIGEST}"
cosign sign --yes "${GHCR_IMAGE}@${DIGEST}"