[docker] Make python version configurable on docker image (#10783)

This commit is contained in:
Lee moon soo
2020-09-15 16:07:29 -07:00
committed by GitHub
parent 8d6fee14c7
commit 65065cc19d
2 changed files with 11 additions and 3 deletions
+9 -2
View File
@@ -8,6 +8,7 @@ set -x
GPU=""
BASE_IMAGE="ubuntu:focal"
WHEEL_URL="https://s3-us-west-2.amazonaws.com/ray-wheels/latest/ray-1.1.0.dev0-cp37-cp37m-manylinux1_x86_64.whl"
PYTHON_VERSION=""
while [[ $# -gt 0 ]]
do
@@ -37,8 +38,14 @@ case $key in
echo "not implemented, just hardcode me :'("
exit 1
;;
--python-version)
# Python version to install. e.g. 3.7.7.
# Changing python versions may require a different wheel.
shift
PYTHON_VERSION=$1
;;
*)
echo "Usage: build-docker.sh [ --no-cache-build ] [ --shas-only ] [ --build-development-image ] [ --build-examples ] [ --wheel-to-use ]"
echo "Usage: build-docker.sh [ --no-cache-build ] [ --shas-only ] [ --build-development-image ] [ --build-examples ] [ --wheel-to-use ] [ --python-version ]"
exit 1
esac
shift
@@ -55,7 +62,7 @@ do
IMAGE_SHA=$(docker build $NO_CACHE --build-arg GPU="$GPU" --build-arg BASE_IMAGE="$BASE_IMAGE" --build-arg WHEEL_PATH="$(basename "$WHEEL")" -q -t rayproject/$IMAGE:latest docker/$IMAGE)
echo "rayproject/$IMAGE:latest SHA:$IMAGE_SHA"
else
docker build $NO_CACHE --build-arg GPU="$GPU" --build-arg BASE_IMAGE="$BASE_IMAGE" --build-arg WHEEL_PATH="$(basename "$WHEEL")" -t rayproject/$IMAGE:latest docker/$IMAGE
docker build $NO_CACHE --build-arg GPU="$GPU" --build-arg BASE_IMAGE="$BASE_IMAGE" --build-arg WHEEL_PATH="$(basename "$WHEEL")" --build-arg PYTHON_VERSION="$PYTHON_VERSION" -t rayproject/$IMAGE:latest docker/$IMAGE
fi
rm "docker/$IMAGE/$(basename "$WHEEL")"
done
+2 -1
View File
@@ -9,6 +9,7 @@ ENV TZ=America/Los_Angeles
# TODO(ilr) $HOME seems to point to result in "" instead of "/root"
ENV PATH "/root/anaconda3/bin:$PATH"
ARG DEBIAN_FRONTEND=noninteractive
ARG PYTHON_VERSION=3.7.7
RUN apt-get update -y && apt-get upgrade -y \
&& apt-get install -y \
git \
@@ -28,7 +29,7 @@ RUN apt-get update -y && apt-get upgrade -y \
&& echo 'export PATH=$HOME/anaconda3/bin:$PATH' > /etc/profile.d/conda.sh \
&& rm /tmp/miniconda.sh \
&& $HOME/anaconda3/bin/conda install -y \
libgcc python=3.7.7 \
libgcc python=$PYTHON_VERSION \
&& $HOME/anaconda3/bin/conda clean -y --all \
&& $HOME/anaconda3/bin/pip install --no-cache-dir \
flatbuffers \