From 18d5fdb63671b6b66ca64e26d04338b1f9c5842b Mon Sep 17 00:00:00 2001 From: Cao Mingjun Date: Wed, 14 Aug 2024 12:57:44 +0800 Subject: [PATCH] CI: add commit sha to image label and tag --- .github/workflows/build-publish.yml | 3 +++ .gitignore | 6 +++++- Dockerfile | 8 ++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-publish.yml b/.github/workflows/build-publish.yml index c43a10c..29d9169 100644 --- a/.github/workflows/build-publish.yml +++ b/.github/workflows/build-publish.yml @@ -59,9 +59,12 @@ jobs: with: build-args: | GOST_VERSION=${{ steps.get-gost-version.outputs.GOST_VERSION }} + WARP_VERSION=${{ steps.get-warp-client-version.outputs.WARP_VERSION }} + COMMIT_SHA=${{ github.sha }} context: . platforms: linux/amd64,linux/arm64 push: true tags: | ${{ vars.REGISTRY }}/${{ vars.IMAGE_NAME }}:latest ${{ vars.REGISTRY }}/${{ vars.IMAGE_NAME }}:${{ steps.get-warp-client-version.outputs.WARP_VERSION }}-${{ steps.get-gost-version.outputs.GOST_VERSION }} + ${{ vars.REGISTRY }}/${{ vars.IMAGE_NAME }}:${{ steps.get-warp-client-version.outputs.WARP_VERSION }}-${{ steps.get-gost-version.outputs.GOST_VERSION }}-${{ github.sha }} diff --git a/.gitignore b/.gitignore index adbb97d..810eb9e 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,5 @@ -data/ \ No newline at end of file +data/ + +# debug github actions +.secrets +.vars \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 5d1771d..135083f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,16 @@ FROM ubuntu:22.04 +ARG WARP_VERSION ARG GOST_VERSION +ARG COMMIT_SHA ARG TARGETPLATFORM +LABEL org.opencontainers.image.authors="cmj2002" +LABEL org.opencontainers.image.url="https://github.com/cmj2002/warp-docker" +LABEL WARP_VERSION=${WARP_VERSION} +LABEL GOST_VERSION=${GOST_VERSION} +LABEL COMMIT_SHA=${COMMIT_SHA} + COPY entrypoint.sh /entrypoint.sh # install dependencies