Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docker] Add script for mirroring dockerhub images #12204

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2684,14 +2684,14 @@ steps:
- create_ci_test_repo
- kind: buildImage2
name: hailgenetics_hail_image
dockerFile: /io/docker/hail/Dockerfile
contextPath: /io/docker/hail/
dockerFile: /io/docker/hailgenetics/hail/Dockerfile
contextPath: /io/docker/hailgenetics/hail
publishAs: hailgenetics/hail
inputs:
- from: /repo/docker/hail
to: /io/docker/hail
- from: /repo/docker/hailgenetics/hail
to: /io/docker/hailgenetics/hail
- from: /just-wheel/wheel-container.tar
to: /io/docker/hail/wheel-container.tar
to: /io/docker/hailgenetics/hail/wheel-container.tar
dependsOn:
- merge_code
- build_hail_jar_and_wheel_only
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