Files
xdu-dockerfile/.gitea/workflows/build.yaml
xkm f17aaa8623
All checks were successful
images-build-and-push / build (., debian-12.dockerfile, xdu/debian:bookworm , debian-12) (push) Successful in 44s
images-build-and-push / build (., debian.dockerfile, xdu/debian:latest xdu/debian:trixie , debian) (push) Successful in 39s
images-build-and-push / build (., ffmpeg-debian.dockerfile, xdu/ffmpeg:debian xdu/ffmpeg:latest , ffmpeg) (push) Successful in 39s
images-build-and-push / build (., ubuntu-24.04.dockerfile, xdu/ubuntu:24.04 , ubuntu-24.04) (push) Successful in 1m5s
images-build-and-push / build (., ubuntu.dockerfile, xdu/ubuntu:latest xdu/ubuntu:25.10 , ubuntu) (push) Successful in 1m9s
add: ubuntu:24.04
fix: mirrors of ubuntu-security
2025-10-17 17:04:50 +08:00

97 lines
2.6 KiB
YAML

name: images-build-and-push
on:
push:
branches: [ "main" ]
workflow_dispatch: {}
env:
REGISTRY: ${{ secrets.REGISTRY }}
REGISTRY_USER: ${{ secrets.REGISTRY_USER }}
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- name: debian
context: .
dockerfile: debian.dockerfile
image: |
xdu/debian:latest
xdu/debian:trixie
- name: debian-12
context: .
dockerfile: debian-12.dockerfile
image: |
xdu/debian:bookworm
- name: ubuntu
context: .
dockerfile: ubuntu.dockerfile
image: |
xdu/ubuntu:latest
xdu/ubuntu:25.10
- name: ubuntu-24.04
context: .
dockerfile: ubuntu-24.04.dockerfile
image: |
xdu/ubuntu:24.04
- name: ffmpeg
context: .
dockerfile: ffmpeg-debian.dockerfile
image: |
xdu/ffmpeg:debian
xdu/ffmpeg:latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Login to registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ env.REGISTRY_USER }}
password: ${{ env.REGISTRY_PASSWORD }}
- name: Prepare tags & cache repo
id: meta
shell: bash
run: |
FULL_TAGS=""
FIRST_REPO=""
while IFS= read -r line; do
[ -z "$line" ] && continue
TAG="${{ env.REGISTRY }}/$line"
FULL_TAGS="${FULL_TAGS}${TAG}"$'\n'
if [ -z "$FIRST_REPO" ]; then
FIRST_REPO="${{ env.REGISTRY }}/$(echo "$line" | cut -d: -f1)"
fi
done <<< "${{ matrix.image }}"
{
echo "tags<<__TAGS__"
printf "%s" "$FULL_TAGS"
echo "__TAGS__"
echo "cache_repo=$FIRST_REPO"
} >> "$GITHUB_OUTPUT"
- name: Build & Push (always)
uses: docker/build-push-action@v5
with:
context: ${{ matrix.context }}
file: ${{ matrix.dockerfile }}
push: true
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=registry,ref=${{ steps.meta.outputs.cache_repo }}:buildcache${{ matrix.name }}
cache-to: type=registry,ref=${{ steps.meta.outputs.cache_repo }}:buildcache${{ matrix.name }},mode=max