|
| 1 | +FROM continuumio/miniconda3 |
| 2 | + |
| 3 | +# if you forked pandas, you can pass in your own GitHub username to use your fork |
| 4 | +# i.e. gh_username=myname |
| 5 | +ARG gh_username=pandas-dev |
| 6 | +ARG pandas_home="/home/pandas" |
| 7 | + |
| 8 | +# Avoid warnings by switching to noninteractive |
| 9 | +ENV DEBIAN_FRONTEND=noninteractive |
| 10 | + |
| 11 | +# Configure apt and install packages |
| 12 | +RUN apt-get update \ |
| 13 | + && apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \ |
| 14 | + # |
| 15 | + # Verify git, process tools, lsb-release (common in install instructions for CLIs) installed |
| 16 | + && apt-get -y install git iproute2 procps iproute2 lsb-release \ |
| 17 | + # |
| 18 | + # Install C compilers (gcc not enough, so just went with build-essential which admittedly might be overkill), |
| 19 | + # needed to build pandas C extensions |
| 20 | + && apt-get -y install build-essential \ |
| 21 | + # |
| 22 | + # cleanup |
| 23 | + && apt-get autoremove -y \ |
| 24 | + && apt-get clean -y \ |
| 25 | + && rm -rf /var/lib/apt/lists/* |
| 26 | + |
| 27 | +# Switch back to dialog for any ad-hoc use of apt-get |
| 28 | +ENV DEBIAN_FRONTEND=dialog |
| 29 | + |
| 30 | +# Clone pandas repo |
| 31 | +RUN mkdir "$pandas_home" \ |
| 32 | + && git clone "https://github.com/$gh_username/pandas.git" "$pandas_home" \ |
| 33 | + && cd "$pandas_home" \ |
| 34 | + && git remote add upstream "https://github.com/pandas-dev/pandas.git" \ |
| 35 | + && git pull upstream master |
| 36 | + |
| 37 | +# Because it is surprisingly difficult to activate a conda environment inside a DockerFile |
| 38 | +# (from personal experience and per https://github.com/ContinuumIO/docker-images/issues/89), |
| 39 | +# we just update the base/root one from the 'environment.yml' file instead of creating a new one. |
| 40 | +# |
| 41 | +# Set up environment |
| 42 | +RUN conda env update -n base -f "$pandas_home/environment.yml" |
| 43 | + |
| 44 | +# Build C extensions and pandas |
| 45 | +RUN cd "$pandas_home" \ |
| 46 | + && python setup.py build_ext --inplace -j 4 \ |
| 47 | + && python -m pip install -e . |
0 commit comments