From 1a6e9692b72ca13faeca949ae3b3348c718398b8 Mon Sep 17 00:00:00 2001 From: Deon George Date: Tue, 25 Feb 2025 09:24:11 +1100 Subject: [PATCH] Get version into build image automatically, add docker image labels --- .gitea/workflows/build_docker.yaml | 3 +++ docker/Dockerfile | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/.gitea/workflows/build_docker.yaml b/.gitea/workflows/build_docker.yaml index ac76487e..dc1bb39a 100644 --- a/.gitea/workflows/build_docker.yaml +++ b/.gitea/workflows/build_docker.yaml @@ -105,6 +105,7 @@ jobs: run: | registry=${{ github.server_url }} echo "registry=${registry##http*://}" >> "$GITHUB_OUTPUT" + echo "version=$(cat public/VERISON)" - name: Container Registry Login uses: docker/login-action@v2 @@ -144,6 +145,7 @@ jobs: - name: Record version and Delete Unnecessary files run: | + echo Building [${{ steps.registry.outputs.version }}] echo ${GITHUB_SHA::8} > VERSION rm -rf .git* tests/ storage/app/test/ ls -al public/css/ @@ -156,6 +158,7 @@ jobs: file: docker/Dockerfile push: true tags: "${{ steps.registry.outputs.registry }}/${{ env.GITHUB_REPOSITORY }}:${{ env.VERSIONARCH }}" + build-args: BUILD_REVISION=${GITHUB_SHA},BUILD_VERSION=${{ steps.registry.outputs.version }} manifest: name: Final Docker Image Manifest diff --git a/docker/Dockerfile b/docker/Dockerfile index 27f4eacf..23466929 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,5 +1,17 @@ FROM dunglas/frankenphp:php8.4-alpine +ARG BUILD_VERSION=2.0.0-dev +ARG BUILD_REVISION=00000000 + +LABEL org.opencontainers.image.vendor="Deon George" +LABEL org.opencontainers.image.licenses=GPLv2 +LABEL org.opencontainers.image.source=https://github.com/leenooks/phpldapadmin +LABEL org.opencontainers.image.title=phpLDAPadmin +LABEL org.opencontainers.image.description="An LDAP Administration Tool" +LABEL org.opencontainers.image.url=https://phpldapadmin.org +LABEL org.opencontainers.image.version=${BUILD_VERSION} +LABEL org.opencontainers.image.revision=${BUILD_REVISION} + # Base RUN apk add --no-cache bash