ci(docker): add OCI labels and build metadata to Docker images

Add comprehensive OCI Image Specification labels to Dockerfile including version, build date, and VCS reference. Update GitHub Actions workflows to pass build arguments for proper image metadata tracking.

- Add OCI labels for title, description, version, created date, revision, authors, vendor, licenses, and URLs
- Extract version from VERSION file in both develop and version workflows
- Pass APP_VERSION, BUILD_DATE, and VCS_REF as build arguments
This commit is contained in:
bobokun 2025-08-19 18:47:58 -04:00
parent 9e3575426b
commit 76f6579ce1
No known key found for this signature in database
GPG key ID: B73932169607D927
8 changed files with 128 additions and 72 deletions

View file

@ -376,6 +376,16 @@ jobs:
id: buildx
uses: docker/setup-buildx-action@v3
- name: Read version from VERSION file
id: get_version
run: echo "APP_VERSION=$(cat VERSION)" >> $GITHUB_OUTPUT
- name: Set build metadata
id: build_meta
run: |
echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
echo "VCS_REF=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
- name: Build and push
id: docker_build
uses: docker/build-push-action@v6
@ -383,7 +393,10 @@ jobs:
context: ./
file: ./Dockerfile
build-args: |
"BRANCH_NAME=develop"
BRANCH_NAME=develop
APP_VERSION=${{ steps.get_version.outputs.APP_VERSION }}
BUILD_DATE=${{ steps.build_meta.outputs.BUILD_DATE }}
VCS_REF=${{ steps.build_meta.outputs.VCS_REF }}
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: true
tags: |

View file

@ -400,12 +400,26 @@ jobs:
id: get_version
run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
- name: Read version from VERSION file
id: get_app_version
run: echo "APP_VERSION=$(cat VERSION)" >> $GITHUB_OUTPUT
- name: Set build metadata
id: build_meta
run: |
echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
echo "VCS_REF=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
- name: Build and push
id: docker_build
uses: docker/build-push-action@v6
with:
context: ./
file: ./Dockerfile
build-args: |
APP_VERSION=${{ steps.get_app_version.outputs.APP_VERSION }}
BUILD_DATE=${{ steps.build_meta.outputs.BUILD_DATE }}
VCS_REF=${{ steps.build_meta.outputs.VCS_REF }}
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: true
tags: |

View file

@ -5,6 +5,7 @@ repos:
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
exclude: ^desktop/tauri/src-tauri/tauri\.conf\.json$
- id: check-merge-conflict
- id: check-json
- id: check-yaml
@ -13,6 +14,7 @@ repos:
- id: fix-byte-order-marker
- id: pretty-format-json
args: [--autofix, --indent, '4', --no-sort-keys]
exclude: ^desktop/tauri/src-tauri/tauri\.conf\.json$
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.37.1 # or higher tag
hooks:
@ -41,3 +43,11 @@ repos:
language: script
pass_filenames: false
stages: [pre-commit]
- id: cargo-check
name: Cargo check for Tauri desktop app
entry: bash -c "cd desktop/tauri/src-tauri && cargo check"
language: system
pass_filenames: false
files: ^desktop/tauri/src-tauri/.*\.(rs|toml|lock|json)$
stages: [pre-commit]
types_or: [rust, toml, json]

View file

@ -27,6 +27,25 @@ RUN /root/.local/bin/uv pip install --system .
# Final stage: minimal runtime image
FROM python:3.13-alpine
# Build arguments
ARG APP_VERSION
ARG BUILD_DATE
ARG VCS_REF
# OCI Image Specification labels
LABEL org.opencontainers.image.title="qbit-manage"
LABEL org.opencontainers.image.description="This tool will help manage tedious tasks in qBittorrent and automate them. Tag, categorize, remove Orphaned data, remove unregistered torrents and much much more."
LABEL org.opencontainers.image.version="$APP_VERSION"
LABEL org.opencontainers.image.created="$BUILD_DATE"
LABEL org.opencontainers.image.revision="$VCS_REF"
LABEL org.opencontainers.image.authors="bobokun"
LABEL org.opencontainers.image.vendor="StuffAnThings"
LABEL org.opencontainers.image.licenses="MIT"
LABEL org.opencontainers.image.url="https://github.com/StuffAnThings/qbit_manage"
LABEL org.opencontainers.image.documentation="https://github.com/StuffAnThings/qbit_manage/wiki"
LABEL org.opencontainers.image.source="https://github.com/StuffAnThings/qbit_manage"
LABEL org.opencontainers.image.base.name="python:3.13-alpine"
ENV TINI_VERSION=v0.19.0
# Runtime dependencies (smaller than build stage)

View file

@ -1 +1 @@
4.5.5-develop7
4.5.5-develop8

View file

@ -2917,7 +2917,7 @@ dependencies = [
[[package]]
name = "qbit-manage-desktop"
version = "4.5.4-develop51"
version = "4.5.5-develop8"
dependencies = [
"libc",
"once_cell",

View file

@ -43,7 +43,7 @@ license = "MIT"
name = "qbit-manage-desktop"
repository = ""
rust-version = "1.70"
version = "4.5.4-develop52"
version = "4.5.5-develop8"
[target."cfg(unix)".dependencies]
libc = "0.2"

View file

@ -68,5 +68,5 @@
},
"identifier": "com.qbitmanage.desktop",
"productName": "qBit Manage",
"version": "4.5.4-develop52"
"version": "4.5.5-develop8"
}