Build CUDA images for both amd and arm (#1590)

This commit is contained in:
Jonatan Kłosko 2022-12-29 21:16:37 +01:00 committed by GitHub
parent bf87a8ac6c
commit a9583fde92
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 32 deletions

View file

@ -104,10 +104,25 @@ jobs:
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: livebook/livebook
flavor: |
latest=false
tags: |
type=semver,pattern={{version}}-cuda11.8
type=raw,value=latest-cuda11.8
- name: Build and push
run: |
version=${GITHUB_REF#refs/*/v}
docker/build_and_push.sh $version,latest true
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
build-args: |
BASE_IMAGE=livebook/utils:elixir-cuda11.8
create_draft_release:
if: github.ref_type == 'tag'

View file

@ -1,36 +1,17 @@
#!/bin/bash
set -e
# Builds base images used to build extra flavours of Livebook images
set -ex
cd "$(dirname "$0")/.."
print_usage_and_exit() {
echo "Usage: $0 <versions> <push>"
echo ""
echo "Builds extra variants of the regular Livebook Docker image."
echo ""
echo "<versions> is a comma-separated list of versions to use in the image tags (such as 0.1.0 or latest)."
echo "Set <push> to 'true' to also pushe the images."
exit 1
}
if [ $# -ne 2 ]; then
print_usage_and_exit
fi
versions=$1
push=$2
elixir=1.14.2
erlang=24.3.4.2
docker build -t elixir-cuda11.8 --build-arg ELIXIR_VERSION=$elixir --build-arg ERLANG_VERSION=$erlang --build-arg CUDA_VERSION=11.8.0 -f docker/base/elixir-cuda.dockerfile docker/base
docker build -t livebook-cuda11.8 --build-arg BASE_IMAGE=elixir-cuda11.8 .
for version in ${versions//,/ }; do
image=livebook/livebook:$version-cuda11.8
docker tag livebook-cuda11.8 $image
if [[ "$2" == "true" ]]; then
docker push $image
fi
done
docker buildx build --push --platform linux/amd64,linux/arm64 \
-t livebook/utils:elixir-cuda11.8 \
--build-arg ELIXIR_VERSION=$elixir \
--build-arg ERLANG_VERSION=$erlang \
--build-arg CUDA_VERSION=11.8.0 \
-f docker/base/elixir-cuda.dockerfile \
docker/base