From 5ca13d49044a38f231aade752ea1ecd00a70571a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonatan=20K=C5=82osko?= Date: Thu, 15 Jun 2023 14:17:03 +0200 Subject: [PATCH] Use shared versions when building Docker images (#1980) --- .github/workflows/deploy.yml | 13 ++++++++++++- .github/workflows/uffizzi-build.yml | 3 +++ Dockerfile | 2 +- docker/build_and_push.sh | 3 +-- versions | 2 ++ 5 files changed, 19 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 940ee0f8b..fa7c2d0d3 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -66,6 +66,11 @@ jobs: # The output is set only if there was a commit, otherwise # we pass an empty ref and and the default is used ref: ${{ needs.assets.outputs.sha }} + - run: | + . versions + echo "elixir=$elixir" >> $GITHUB_ENV + echo "otp=$otp" >> $GITHUB_ENV + echo "debian=$debian" >> $GITHUB_ENV - name: Set up QEMU uses: docker/setup-qemu-action@v2 - name: Set up Docker Buildx @@ -93,6 +98,8 @@ jobs: tags: ${{ steps.meta.outputs.tags }} cache-from: type=gha cache-to: type=gha,mode=max + build-args: | + BASE_IMAGE=hexpm/elixir:${{ env.elixir }}-erlang-${{ env.otp }}-debian-${{ env.debian }} docker_extras: if: github.ref_type == 'tag' @@ -101,6 +108,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + - run: | + . versions + echo "elixir=$elixir" >> $GITHUB_ENV + echo "otp=$otp" >> $GITHUB_ENV - name: Set up QEMU uses: docker/setup-qemu-action@v1 - name: Set up Docker Buildx @@ -129,7 +140,7 @@ jobs: push: true tags: ${{ steps.meta.outputs.tags }} build-args: | - BASE_IMAGE=ghcr.io/livebook-dev/utils:elixir-cuda11.8 + BASE_IMAGE=ghcr.io/livebook-dev/utils:elixir-${{ env.elixir }}-erlang-${{ env.otp }}-cuda11.8 create_draft_release: if: github.ref_type == 'tag' diff --git a/.github/workflows/uffizzi-build.yml b/.github/workflows/uffizzi-build.yml index a113f5f65..4227cd439 100644 --- a/.github/workflows/uffizzi-build.yml +++ b/.github/workflows/uffizzi-build.yml @@ -17,6 +17,7 @@ jobs: . versions echo "elixir=$elixir" >> $GITHUB_ENV echo "otp=$otp" >> $GITHUB_ENV + echo "debian=$debian" >> $GITHUB_ENV # --- START build assets - name: Install Erlang & Elixir uses: erlef/setup-beam@v1 @@ -74,6 +75,8 @@ jobs: file: ./Dockerfile cache-from: type=gha cache-to: type=gha,mode=max + build-args: | + BASE_IMAGE=hexpm/elixir:${{ env.elixir }}-erlang-${{ env.otp }}-debian-${{ env.debian }} render-compose-file: name: Render Docker Compose file diff --git a/Dockerfile b/Dockerfile index 0056130d8..54fc0033f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -ARG BASE_IMAGE=hexpm/elixir:1.15.0-rc.2-erlang-25.3.2-debian-bullseye-20230522-slim +ARG BASE_IMAGE # Stage 1 # Builds the Livebook release diff --git a/docker/build_and_push.sh b/docker/build_and_push.sh index e78dca53a..e42f14449 100755 --- a/docker/build_and_push.sh +++ b/docker/build_and_push.sh @@ -6,10 +6,9 @@ set -ex cd "$(dirname "$0")/.." . versions -ubuntu="focal-20230126" docker buildx build --push --platform linux/amd64,linux/arm64 \ - -t ghcr.io/livebook-dev/utils:elixir-cuda11.8 \ + -t ghcr.io/livebook-dev/utils:elixir-$elixir-erlang-$otp-cuda11.8 \ --build-arg ELIXIR_VERSION=$elixir \ --build-arg ERLANG_VERSION=$otp \ --build-arg UBUNTU_VERSION=$ubuntu \ diff --git a/versions b/versions index 8000f6988..1a378f1ff 100644 --- a/versions +++ b/versions @@ -2,3 +2,5 @@ elixir="1.15.0-rc.2" otp="25.3.2" openssl="1.1.1s" rebar3="3.22.0" +debian="bullseye-20230522-slim" +ubuntu="focal-20230126"