Skip to content
Open
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
26 changes: 14 additions & 12 deletions docker/vm_boot_images/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ set -e
################### VARIABLES ############################################

REPO="gcr.io/broad-ml4cvd/deeplearning"
GAR_REPO="us-central1-docker.pkg.dev/broad-ml4cvd/deeplearning"
GITHUB_REPO="ghcr.io/broadinstitute/ml4h"
GITHUB_SHA=$( git rev-parse --short HEAD )
TAG=$( git rev-parse --short HEAD )
CONTEXT="docker/vm_boot_images/"
CPU_ONLY="false"
PUSH_TO_GCR="false"
PUSH_TO_GAR="false"
PUSH_TO_LATEST="false"

BASE_IMAGE_GPU="tensorflow/tensorflow:2.9.1-gpu"
Expand Down Expand Up @@ -80,7 +82,7 @@ while getopts ":d:t:chpP" opt ; do
CPU_ONLY="true"
;;
p)
PUSH_TO_GCR="true"
PUSH_TO_GAR="true"
;;
P)
PUSH_TO_LATEST="true"
Expand Down Expand Up @@ -113,28 +115,28 @@ else
fi

echo BASE_IMAGE $BASE_IMAGE LATEST_TAG $LATEST_TAG
echo -e "${BLUE}Building Docker image '${REPO}:${TAG}' from base image '${BASE_IMAGE}', and also tagging it as '${LATEST_TAG}'...${NC}"
echo -e "${BLUE}Building Docker image '${GAR_REPO}:${TAG}' from base image '${BASE_IMAGE}', and also tagging it as '${LATEST_TAG}'...${NC}"
# --network host allows for the container's network stack to use the Docker host's network
docker build ${CONTEXT} \
--build-arg BASE_IMAGE=${BASE_IMAGE} \
--tag "${REPO}:${TAG}" \
--tag "${REPO}:${LATEST_TAG}" \
--tag "${GAR_REPO}/${GITHUB_SHA}:${TAG}" \
--tag "${GAR_REPO}/${GITHUB_SHA}:${LATEST_TAG}" \
--tag "${GITHUB_REPO}:${TAG}" \
--tag "${GITHUB_REPO}:${LATEST_TAG}" \
--network host \

echo PUSH_TO_LATEST $PUSH_TO_LATEST
if [[ ${PUSH_TO_LATEST} == "true" ]]; then
echo -e "${BLUE}Pushing the image '${REPO}' to Github GHCR and Google Container Registry with tags '${TAG}' and '${LATEST_TAG}'...${NC}"
docker push ${REPO}:${TAG}
docker push ${REPO}:${LATEST_TAG}
echo -e "${BLUE}Pushing the image '${GAR_REPO}' to Github GHCR and Google Artifact Repository with tags '${TAG}' and '${LATEST_TAG}'...${NC}"
docker push ${GAR_REPO}/${GITHUB_SHA}:${TAG}
docker push ${GAR_REPO}/${GITHUB_SHA}:${LATEST_TAG}

docker push ${GITHUB_REPO}:${TAG}
docker push ${GITHUB_REPO}:${LATEST_TAG}
fi

echo PUSH_TO_GCR $PUSH_TO_GCR
if [[ ${PUSH_TO_GCR} == "true" ]]; then
echo -e "${BLUE}Pushing the image '${REPO}' to Google Container Registry with tags '${TAG}'...${NC}"
docker push ${REPO}:${TAG}
echo PUSH_TO_GAR $PUSH_TO_GAR
if [[ ${PUSH_TO_GAR} == "true" ]]; then
echo -e "${BLUE}Pushing the image '${GAR_REPO}' to Google Artifact Repository with tags '${TAG}'...${NC}"
docker push ${GAR_REPO}:${TAG}
fi
Loading