Skip to content

Instantly share code, notes, and snippets.

@pangyuteng
Last active April 25, 2024 02:16
Show Gist options
  • Star 35 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save pangyuteng/f5b00fe63ac31a27be00c56996197597 to your computer and use it in GitHub Desktop.
Save pangyuteng/f5b00fe63ac31a27be00c56996197597 to your computer and use it in GitHub Desktop.
docker miniconda ubuntu
#
# ref https://github.com/tebeka/pythonwise/blob/master/docker-miniconda/Dockerfile
#
# miniconda vers: http://repo.continuum.io/miniconda
# sample variations:
# Miniconda3-latest-Linux-armv7l.sh
# Miniconda3-latest-Linux-x86_64.sh
# Miniconda3-py38_4.10.3-Linux-x86_64.sh
# Miniconda3-py37_4.10.3-Linux-x86_64.sh
#
# py vers: https://anaconda.org/anaconda/python/files
# tf vers: https://anaconda.org/anaconda/tensorflow/files
# tf-mkl vers: https://anaconda.org/anaconda/tensorflow-mkl/files
#
ARG UBUNTU_VER=18.04
ARG CONDA_VER=latest
ARG OS_TYPE=x86_64
ARG PY_VER=3.8.11
ARG TF_VER=2.5.0
FROM ubuntu:${UBUNTU_VER}
# System packages
RUN apt-get update && apt-get install -yq curl wget jq vim
# Use the above args during building https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact
ARG CONDA_VER
ARG OS_TYPE
# Install miniconda to /miniconda
RUN curl -LO "http://repo.continuum.io/miniconda/Miniconda3-${CONDA_VER}-Linux-${OS_TYPE}.sh"
RUN bash Miniconda3-${CONDA_VER}-Linux-${OS_TYPE}.sh -p /miniconda -b
RUN rm Miniconda3-${CONDA_VER}-Linux-${OS_TYPE}.sh
ENV PATH=/miniconda/bin:${PATH}
RUN conda update -y conda
ARG PY_VER
ARG TF_VER
# Install packages from conda and downgrade py (optional).
RUN conda install -c anaconda -y python=${PY_VER}
RUN conda install -c anaconda -y \
tensorflow-mkl=${TF_VER} \
&& pip install pyyaml pandas
# some devs like to let it hang https://stackoverflow.com/a/42873832/868736
# ENTRYPOINT ["tail", "-f", "/dev/null"]
@fepegar
Copy link

fepegar commented Nov 18, 2019

Thanks for sharing 👍

@bryanwhiting
Copy link

Still works, thanks!

@pangyuteng
Copy link
Author

pangyuteng commented Sep 30, 2021

noice. :)

--
added usage of args.

ARG UBUNTU_VER=18.04
ARG CONDA_VER=latest
ARG OS_TYPE=x86_64
ARG PY_VER=3.8.11
ARG TF_VER=2.5.0

container size built with above is 3.01GB

@fabiom91
Copy link

thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment