From 0f7345220beca5147f16e4e827b338dd9923525a Mon Sep 17 00:00:00 2001 From: lklimek <842586+lklimek@users.noreply.github.com> Date: Fri, 29 Nov 2024 07:08:34 +0100 Subject: [PATCH] ci: docker image always released as -dev (#2358) --- .github/actions/docker/action.yaml | 4 +++- .github/workflows/release-docker-image.yml | 2 ++ Dockerfile | 7 ++++--- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/actions/docker/action.yaml b/.github/actions/docker/action.yaml index 495222f7249..459a3fe6c4c 100644 --- a/.github/actions/docker/action.yaml +++ b/.github/actions/docker/action.yaml @@ -190,7 +190,9 @@ runs: platforms: ${{ inputs.platform }} secret-files: | AWS=${{ env.HOME }}/.aws/credentials - build-args: ${{ steps.sccache.outputs.env_vars }} + build-args: | + CARGO_BUILD_PROFILE=${{ inputs.cargo_profile }} + ${{ steps.sccache.outputs.env_vars }} cache-from: ${{ steps.layer_cache_settings.outputs.cache_from }} cache-to: ${{ steps.layer_cache_settings.outputs.cache_to }} outputs: type=image,name=${{ inputs.image_org }}/${{ inputs.image_name }},push-by-digest=${{ inputs.push_tags != 'true' }},name-canonical=true,push=true diff --git a/.github/workflows/release-docker-image.yml b/.github/workflows/release-docker-image.yml index 728bd7e94ce..7d43c13fa8f 100644 --- a/.github/workflows/release-docker-image.yml +++ b/.github/workflows/release-docker-image.yml @@ -68,6 +68,8 @@ jobs: cache_endpoint: ${{ vars.CACHE_S3_ENDPOINT }} cache_access_key_id: ${{ secrets.CACHE_KEY_ID }} cache_secret_access_key: ${{ secrets.CACHE_SECRET_KEY }} + # On release, we generate a new "base" image, so we need to save cache to name manifest, like '.../drive' + cache_to_name: ${{ github.event_name == 'release' && 'true' || 'false' }} - name: Export digest run: | diff --git a/Dockerfile b/Dockerfile index 0236a9e20e5..568e232cc6e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -131,9 +131,6 @@ RUN if [[ "$TARGETARCH" == "arm64" ]] ; then export PROTOC_ARCH=aarch_64; else e # Switch to clang RUN rm /usr/bin/cc && ln -s /usr/bin/clang /usr/bin/cc -# Select whether we want dev or release -ONBUILD ARG CARGO_BUILD_PROFILE=dev - ARG NODE_ENV=production ENV NODE_ENV=${NODE_ENV} @@ -326,6 +323,10 @@ RUN --mount=type=secret,id=AWS \ --no-track \ --no-confirm + +# Select whether we want dev or release +ONBUILD ARG CARGO_BUILD_PROFILE=dev + # # Rust build planner to speed up builds #