From 50d9fe036e8478f8a9f4ef9ebd29b328a0bcdbc5 Mon Sep 17 00:00:00 2001 From: Bruno Casali Date: Tue, 6 Dec 2022 17:44:31 -0300 Subject: [PATCH 1/2] Setup COMMIT_SHA and COMMIT_DATE build args in the Docker image --- .github/workflows/publish-docker-images.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/publish-docker-images.yml b/.github/workflows/publish-docker-images.yml index a168c0bd8..17e85b322 100644 --- a/.github/workflows/publish-docker-images.yml +++ b/.github/workflows/publish-docker-images.yml @@ -39,6 +39,14 @@ jobs: if: github.event_name != 'schedule' && steps.check-tag-format.outputs.stable == 'true' run: bash .github/scripts/check-release.sh + - name: Set build-args for Docker buildx + id: build-metadata + run: | + # Extract commit date + commit_date=$(git show -s --format=%cd --date=iso-strict ${{ github.sha }}) + + echo "date=$commit_date" >> $GITHUB_OUTPUT + - name: Set up QEMU uses: docker/setup-qemu-action@v2 @@ -72,6 +80,9 @@ jobs: push: ${{ github.event_name != 'schedule' }} platforms: linux/amd64,linux/arm64 tags: ${{ steps.meta.outputs.tags }} + build-args: | + COMMIT_SHA=${{ github.sha }} + COMMIT_DATE=${{ steps.build-metadata.outputs.date }} # /!\ Don't touch this without checking with Cloud team - name: Send CI information to Cloud team From 58327979f158a9b1ad2e6ae399ce61db906c2318 Mon Sep 17 00:00:00 2001 From: Bruno Casali Date: Wed, 7 Dec 2022 17:21:19 -0300 Subject: [PATCH 2/2] Use correct env vars "VERGEN_*" on Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 0e54fcdae..6846fdad7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,7 @@ WORKDIR /meilisearch ARG COMMIT_SHA ARG COMMIT_DATE -ENV COMMIT_SHA=${COMMIT_SHA} COMMIT_DATE=${COMMIT_DATE} +ENV VERGEN_GIT_SHA=${COMMIT_SHA} VERGEN_GIT_COMMIT_TIMESTAMP=${COMMIT_DATE} ENV RUSTFLAGS="-C target-feature=-crt-static" COPY . .