Skip to content

Commit

Permalink
[docker] Add script for mirroring dockerhub images
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-goldstein committed Sep 19, 2022
1 parent 3f31b55 commit 784edd8
Show file tree
Hide file tree
Showing 13 changed files with 91 additions and 50 deletions.
2 changes: 1 addition & 1 deletion build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2681,7 +2681,7 @@ steps:
- create_ci_test_repo
- kind: buildImage2
name: hailgenetics_hail_image
dockerFile: /io/docker/hail/Dockerfile
dockerFile: /io/docker/hailgenetics/hail/Dockerfile
contextPath: /io/docker/hail/
publishAs: hailgenetics/hail
inputs:
Expand Down
13 changes: 13 additions & 0 deletions docker/copy_image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
if command -v skopeo
then
copy_image() {
skopeo copy --override-os linux --override-arch amd64 docker://docker.io/$1 docker://$2
}
else
echo Could not find skopeo, falling back to docker which will be slower.
copy_image() {
docker pull $1
docker tag $1 $2
docker push $2
}
fi
11 changes: 11 additions & 0 deletions docker/hailgenetics/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
include ../../config.mk

.PHONY: publish-python-dill

publish-python-dill:
DOCKER_PREFIX=$(DOCKER_PREFIX) bash python-dill/push.sh

mirror-dockerhub-images:
DOCKER_PREFIX=$(DOCKER_PREFIX) \
HAIL_PIP_VERSION=$(shell cat ../../hail/python/hail/hail_pip_version) \
./mirror_images.sh
File renamed without changes.
File renamed without changes.
42 changes: 42 additions & 0 deletions docker/hailgenetics/mirror_images.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash

set -ex

source ../copy_image.sh

if [[ -z "${DOCKER_PREFIX}" ]];
then
echo "Env variable DOCKER_PREFIX must be set"
exit 1
fi

if [[ -z "${HAIL_PIP_VERSION}" ]];
then
echo "Env variable HAIL_PIP_VERSION must be set"
exit 1
fi

python_dill_images=(
"python-dill:3.7"
"python-dill:3.7-slim"
"python-dill:3.8"
"python-dill:3.8-slim"
"python-dill:3.9"
"python-dill:3.9-slim"
"python-dill:3.10"
"python-dill:3.10-slim"
)

for image in "${python_dill_images[@]}"
do
copy_image "hailgenetics/${image}" "${DOCKER_PREFIX}/hailgenetics/${image}"
done

pip_release_images=(
"hail:${HAIL_PIP_VERSION}"
"genetics:${HAIL_PIP_VERSION}"
)
for image in "${pip_release_images[@]}"
do
copy_image "hailgenetics/${image}" "${DOCKER_PREFIX}/hailgenetics/${image}"
done
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM python:@PYTHON_VERSION@
ARG PYTHON_VERSION
FROM python:${PYTHON_VERSION}
RUN pip install --upgrade --no-cache-dir dill numpy scipy sklearn && \
python3 -m pip check && \
apt-get update && \
Expand Down
17 changes: 17 additions & 0 deletions docker/hailgenetics/python-dill/push.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

set -ex

for version in 3.7 3.7-slim 3.8 3.8-slim 3.9 3.9-slim 3.10 3.10-slim
do
public=hailgenetics/python-dill:$version

DOCKER_BUILDKIT=1 docker build \
--build-arg PYTHON_VERSION=$version \
--file Dockerfile.out \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--tag ${public} \
.

time DOCKER_BUILDKIT=1 docker push ${public}
done
4 changes: 0 additions & 4 deletions docker/python-dill/Makefile

This file was deleted.

1 change: 0 additions & 1 deletion docker/python-dill/README.md

This file was deleted.

23 changes: 0 additions & 23 deletions docker/python-dill/push.sh

This file was deleted.

17 changes: 2 additions & 15 deletions docker/third-party/copy_images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

set -ex

source ../copy_image.sh

images=$(cat images.txt)

if [ -z "${DOCKER_PREFIX}" ]
Expand All @@ -10,21 +12,6 @@ then
exit 1
fi

if command -v skopeo
then
copy_image() {
skopeo copy --override-os linux --override-arch amd64 docker://docker.io/$1 docker://$2
}
else
echo Could not find skopeo, falling back to docker which will be slower.
copy_image() {
docker pull $1
docker tag $1 $2
docker push $2
}
fi


for image in ${images}
do
dest="${DOCKER_PREFIX}/${image}"
Expand Down
8 changes: 3 additions & 5 deletions infra/bootstrap_utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@ fi
source $HAIL/devbin/functions.sh

copy_images() {
cd $HAIL/docker/third-party
DOCKER_PREFIX=$(get_global_config_field docker_prefix)
DOCKER_PREFIX=$DOCKER_PREFIX ./copy_images.sh
cd -
make -C $HAIL/docker/third-party copy

make -C $HAIL/docker/python-dill push DOCKER_PREFIX=$DOCKER_PREFIX
make -C $HAIL/hail python/hail/hail_pip_version
make -C $HAIL/docker/hailgenetics mirror-dockerhub-images
}

generate_ssl_certs() {
Expand Down

0 comments on commit 784edd8

Please sign in to comment.