From 71f3dd5e5cc895dc5d1a481e349cc5d5abd6fea9 Mon Sep 17 00:00:00 2001 From: JustArchi Date: Sat, 2 Jan 2021 18:33:16 +0100 Subject: [PATCH] Add opencontainers labels to docker images --- .github/workflows/docker-publish-latest.yml | 6 ++++++ .github/workflows/docker-publish-master.yml | 5 +++++ .github/workflows/docker-publish-released.yml | 5 +++++ Dockerfile | 12 +++++++++++- Dockerfile.Service | 12 +++++++++++- 5 files changed, 38 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-publish-latest.yml b/.github/workflows/docker-publish-latest.yml index 1768d07a7..b0c4e810b 100644 --- a/.github/workflows/docker-publish-latest.yml +++ b/.github/workflows/docker-publish-latest.yml @@ -33,6 +33,8 @@ jobs: run: | set -eu + echo "FIXED_TAG=$(echo ${{ github.ref }} | cut -d '/' -f 3)" >> "$GITHUB_ENV" + echo "DATE_ISO8601=$(date --iso-8601=seconds --utc)" >> "$GITHUB_ENV" echo "GHCR_REPOSITORY=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_ENV" echo "DH_REPOSITORY=$(echo ${{ secrets.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }} | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_ENV" @@ -42,6 +44,10 @@ jobs: file: Dockerfile.Service platforms: linux/amd64,linux/arm,linux/arm64 build-args: STEAM_TOKEN_DUMPER_TOKEN=${{ secrets.STEAM_TOKEN_DUMPER_TOKEN }} + labels: | + org.opencontainers.image.created=${{ env.DATE_ISO8601 }} + org.opencontainers.image.version=${{ env.FIXED_TAG }} + org.opencontainers.image.revision=${{ github.sha }} tags: | ghcr.io/${{ env.GHCR_REPOSITORY }}:${{ env.TAG }} ${{ env.DH_REPOSITORY }}:${{ env.TAG }} diff --git a/.github/workflows/docker-publish-master.yml b/.github/workflows/docker-publish-master.yml index a2842cad1..b134d1782 100644 --- a/.github/workflows/docker-publish-master.yml +++ b/.github/workflows/docker-publish-master.yml @@ -39,6 +39,7 @@ jobs: run: | set -eu + echo "DATE_ISO8601=$(date --iso-8601=seconds --utc)" >> "$GITHUB_ENV" echo "GHCR_REPOSITORY=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_ENV" echo "DH_REPOSITORY=$(echo ${{ secrets.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }} | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_ENV" @@ -47,6 +48,10 @@ jobs: with: platforms: linux/amd64,linux/arm,linux/arm64 build-args: STEAM_TOKEN_DUMPER_TOKEN=${{ secrets.STEAM_TOKEN_DUMPER_TOKEN }} + labels: | + org.opencontainers.image.created=${{ env.DATE_ISO8601 }} + org.opencontainers.image.version=${{ github.sha }} + org.opencontainers.image.revision=${{ github.sha }} tags: | ghcr.io/${{ env.GHCR_REPOSITORY }}:${{ env.TAG }} ${{ env.DH_REPOSITORY }}:${{ env.TAG }} diff --git a/.github/workflows/docker-publish-released.yml b/.github/workflows/docker-publish-released.yml index 00d00b2fa..6be4a0c23 100644 --- a/.github/workflows/docker-publish-released.yml +++ b/.github/workflows/docker-publish-released.yml @@ -35,6 +35,7 @@ jobs: set -eu echo "FIXED_TAG=$(echo ${{ github.ref }} | cut -d '/' -f 3)" >> "$GITHUB_ENV" + echo "DATE_ISO8601=$(date --iso-8601=seconds --utc)" >> "$GITHUB_ENV" echo "GHCR_REPOSITORY=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_ENV" echo "DH_REPOSITORY=$(echo ${{ secrets.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }} | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_ENV" @@ -43,6 +44,10 @@ jobs: with: platforms: linux/amd64,linux/arm,linux/arm64 build-args: STEAM_TOKEN_DUMPER_TOKEN=${{ secrets.STEAM_TOKEN_DUMPER_TOKEN }} + labels: | + org.opencontainers.image.created=${{ env.DATE_ISO8601 }} + org.opencontainers.image.version=${{ env.FIXED_TAG }} + org.opencontainers.image.revision=${{ github.sha }} tags: | ghcr.io/${{ env.GHCR_REPOSITORY }}:${{ env.TAG }} ghcr.io/${{ env.GHCR_REPOSITORY }}:${{ env.FIXED_TAG }} diff --git a/Dockerfile b/Dockerfile index 2a530e2b5..152f95315 100644 --- a/Dockerfile +++ b/Dockerfile @@ -48,7 +48,17 @@ FROM --platform=$TARGETPLATFORM mcr.microsoft.com/dotnet/aspnet:5.0${IMAGESUFFIX ENV ASPNETCORE_URLS= ENV DOTNET_CLI_TELEMETRY_OPTOUT 1 ENV DOTNET_NOLOGO 1 -LABEL maintainer="JustArchi " + +LABEL maintainer="JustArchi " \ + org.opencontainers.image.authors="JustArchi " \ + org.opencontainers.image.url="https://github.com/JustArchiNET/ArchiSteamFarm/wiki/Docker" \ + org.opencontainers.image.documentation="https://github.com/JustArchiNET/ArchiSteamFarm/wiki" \ + org.opencontainers.image.source="https://github.com/JustArchiNET/ArchiSteamFarm" \ + org.opencontainers.image.vendor="JustArchiNET" \ + org.opencontainers.image.licenses="Apache-2.0" \ + org.opencontainers.image.title="ArchiSteamFarm" \ + org.opencontainers.image.description="C# application with primary purpose of idling Steam cards from multiple accounts simultaneously" + EXPOSE 1242 WORKDIR /app COPY --from=build-dotnet /app/out/result . diff --git a/Dockerfile.Service b/Dockerfile.Service index 7e5636b6a..984297ce9 100644 --- a/Dockerfile.Service +++ b/Dockerfile.Service @@ -48,7 +48,17 @@ FROM --platform=$TARGETPLATFORM mcr.microsoft.com/dotnet/runtime-deps:5.0${IMAGE ENV ASPNETCORE_URLS= ENV DOTNET_CLI_TELEMETRY_OPTOUT 1 ENV DOTNET_NOLOGO 1 -LABEL maintainer="JustArchi " + +LABEL maintainer="JustArchi " \ + org.opencontainers.image.authors="JustArchi " \ + org.opencontainers.image.url="https://github.com/JustArchiNET/ArchiSteamFarm/wiki/Docker" \ + org.opencontainers.image.documentation="https://github.com/JustArchiNET/ArchiSteamFarm/wiki" \ + org.opencontainers.image.source="https://github.com/JustArchiNET/ArchiSteamFarm" \ + org.opencontainers.image.vendor="JustArchiNET" \ + org.opencontainers.image.licenses="Apache-2.0" \ + org.opencontainers.image.title="ArchiSteamFarm" \ + org.opencontainers.image.description="C# application with primary purpose of idling Steam cards from multiple accounts simultaneously" + EXPOSE 1242 WORKDIR /app COPY --from=build-dotnet /app/out/result .