Dockerfile 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. ARG BASE_IMAGE="ubuntu:21.04"
  2. FROM ${BASE_IMAGE}
  3. # FROM directive resets ARG
  4. ARG BASE_IMAGE
  5. # If this arg is not "autoscaler" then no autoscaler requirements will be included
  6. ARG AUTOSCALER="autoscaler"
  7. ENV TZ=America/Los_Angeles
  8. ENV PATH "/root/anaconda3/bin:$PATH"
  9. ARG DEBIAN_FRONTEND=noninteractive
  10. ARG PYTHON_VERSION=3.7.7
  11. RUN apt-get update -y \
  12. && apt-get install -y sudo tzdata \
  13. && rm -rf /var/lib/apt/lists/* \
  14. && apt-get clean
  15. RUN apt-get update -y && sudo apt-get upgrade -y \
  16. && sudo apt-get install -y \
  17. git \
  18. wget \
  19. cmake \
  20. g++ \
  21. zlib1g-dev \
  22. $(if [ "$AUTOSCALER" = "autoscaler" ]; then echo \
  23. tmux \
  24. screen \
  25. rsync \
  26. openssh-client \
  27. gnupg; fi) \
  28. unzip \
  29. && wget \
  30. --quiet "https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh" \
  31. -O /tmp/miniconda.sh \
  32. && /bin/bash /tmp/miniconda.sh -b -u -p $HOME/anaconda3 \
  33. && $HOME/anaconda3/bin/conda init \
  34. && echo 'export PATH=$HOME/anaconda3/bin:$PATH' >> /root/.bashrc \
  35. && rm /tmp/miniconda.sh \
  36. && $HOME/anaconda3/bin/conda install -y \
  37. libgcc python=$PYTHON_VERSION \
  38. && $HOME/anaconda3/bin/conda clean -y --all \
  39. && $HOME/anaconda3/bin/pip install --no-cache-dir \
  40. flatbuffers \
  41. cython==0.29.26 \
  42. numpy==1.15.4 \
  43. psutil \
  44. # To avoid the following error on Jenkins:
  45. # AttributeError: 'numpy.ufunc' object has no attribute '__module__'
  46. && $HOME/anaconda3/bin/pip uninstall -y dask \
  47. # We install cmake temporarily to get psutil
  48. && sudo apt-get autoremove -y cmake zlib1g-dev \
  49. # We keep g++ on GPU images, because uninstalling removes CUDA Devel tooling
  50. $(if [ "$BASE_IMAGE" = "ubuntu:focal" ]; then echo \
  51. g++; fi) \
  52. # Either install kubectl or remove wget
  53. && (if [ "$AUTOSCALER" = "autoscaler" ]; \
  54. then wget -O - -q https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - \
  55. && sudo touch /etc/apt/sources.list.d/kubernetes.list \
  56. && echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee -a /etc/apt/sources.list.d/kubernetes.list \
  57. && sudo apt-get update \
  58. && sudo apt-get install kubectl; \
  59. else sudo apt-get autoremove -y wget; \
  60. fi;) \
  61. && sudo rm -rf /var/lib/apt/lists/* \
  62. && sudo apt-get clean
  63. RUN apt-get update -y \
  64. && apt-get install -y gnupg curl golang wget make git libseccomp-dev \
  65. #&& . /etc/os-release \
  66. #&& echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/ /" | tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list \
  67. #&& curl -L https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/Release.key | apt-key add - \
  68. #&& apt-get update \
  69. && apt-get -y install podman runc \
  70. && rm -rf /var/lib/apt/lists/* \
  71. && apt-get clean
  72. ARG WHEEL_PATH
  73. ARG FIND_LINKS_PATH=".whl"
  74. # For Click
  75. ENV LC_ALL=C.UTF-8
  76. ENV LANG=C.UTF-8
  77. COPY $WHEEL_PATH .
  78. COPY $FIND_LINKS_PATH $FIND_LINKS_PATH
  79. RUN $HOME/anaconda3/bin/pip --no-cache-dir install `basename $WHEEL_PATH`[all] \
  80. --find-links $FIND_LINKS_PATH && sudo rm `basename $WHEEL_PATH`