1
+ #
2
+ # Dockerfile for pandas development
3
+ #
4
+ # Usage:
5
+ # -------
6
+ #
7
+ # To make a local build of the container, from the 'Docker-dev' directory:
8
+ # docker build --rm -f "Dockerfile" -t <build-tag> "."
9
+ #
10
+ # To use the container use the following command. It assumes that you are in
11
+ # the root folder of the pandas git repository, making it available as
12
+ # /home/pandas in the container. Whatever changes you make to that directory
13
+ # are visible in the host and container.
14
+ # The docker image is retrieved from the pandas dockerhub repository
15
+ #
16
+ # docker run --rm -it -v $(pwd):/home/pandas pandas/pandas-dev:<image-tag>
17
+ #
18
+ # By default the container will activate the conda environment pandas-dev
19
+ # which contains all the dependencies needed for pandas development
20
+ #
21
+ # To build and install pandas run:
22
+ # python setup.py build_ext -j 4
23
+ # python -m pip install -e . --no-build-isolation
24
+ #
25
+ # This image is based on: Ubuntu 20.04 (focal)
26
+ # https://hub.docker.com/_/ubuntu/?tab=tags&name=focal
27
+ # OS/ARCH: linux/amd64
28
+ FROM gitpod/workspace-base:latest
29
+
30
+ ARG MAMBAFORGE_VERSION="4.11.0-0"
31
+ ARG CONDA_ENV=pandas-dev
32
+ ARG PANDAS_HOME="/home/pandas"
33
+
34
+
35
+ # ---- Configure environment ----
36
+ ENV CONDA_DIR=/home/gitpod/mambaforge3 \
37
+ SHELL=/bin/bash
38
+ ENV PATH=${CONDA_DIR}/bin:$PATH \
39
+ WORKSPACE=/workspace/pandas
40
+
41
+
42
+ # -----------------------------------------------------------------------------
43
+ # ---- Creating as root - note: make sure to change to gitpod in the end ----
44
+ USER root
45
+
46
+ # Avoid warnings by switching to noninteractive
47
+ ENV DEBIAN_FRONTEND=noninteractive
48
+
49
+ # Configure apt and install packages
50
+ RUN apt-get update \
51
+ && apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \
52
+ #
53
+ # Install tzdata and configure timezone (fix for tests which try to read from "/etc/localtime")
54
+ && apt-get -y install tzdata \
55
+ && ln -fs /usr/share/zoneinfo/Etc/UTC /etc/localtime \
56
+ && dpkg-reconfigure -f noninteractive tzdata \
57
+ #
58
+ # Verify git, process tools, lsb-release (common in install instructions for CLIs) installed
59
+ && apt-get -y install git iproute2 procps iproute2 lsb-release \
60
+ #
61
+ # cleanup
62
+ && apt-get autoremove -y \
63
+ && apt-get clean -y \
64
+ && rm -rf /var/lib/apt/lists/*
65
+
66
+ # Switch back to dialog for any ad-hoc use of apt-get
67
+ ENV DEBIAN_FRONTEND=dialog
68
+
69
+ # Allows this Dockerfile to activate conda environments
70
+ SHELL ["/bin/bash" , "--login" , "-o" , "pipefail" , "-c" ]
71
+
72
+ # -----------------------------------------------------------------------------
73
+ # ---- Installing mamba ----
74
+ RUN wget -q -O mambaforge3.sh \
75
+ "https://github.com/conda-forge/miniforge/releases/download/$MAMBAFORGE_VERSION/Mambaforge-$MAMBAFORGE_VERSION-Linux-x86_64.sh" && \
76
+ bash mambaforge3.sh -p ${CONDA_DIR} -b && \
77
+ rm mambaforge3.sh
78
+
79
+ # -----------------------------------------------------------------------------
80
+ # ---- Copy needed files ----
81
+ # basic workspace configurations
82
+ COPY ./gitpod/workspace_config /usr/local/bin/workspace_config
83
+
84
+ RUN chmod a+rx /usr/local/bin/workspace_config && \
85
+ workspace_config
86
+
87
+ # Copy conda environment file into the container - this needs to exists inside
88
+ # the container to create a conda environment from it
89
+ COPY environment.yml /tmp/environment.yml
90
+
91
+ # -----------------------------------------------------------------------------
92
+ # ---- Create conda environment ----
93
+ # Install pandas dependencies
94
+ RUN mamba env create -f /tmp/environment.yml
95
+ RUN conda activate ${CONDA_ENV} && \
96
+ mamba install ccache -y && \
97
+ # needed for docs rendering later on
98
+ python -m pip install --no-cache-dir sphinx-autobuild && \
99
+ conda clean --all -f -y && \
100
+ rm -rf /tmp/*
101
+
102
+ # -----------------------------------------------------------------------------
103
+ # Always make sure we are not root
104
+ USER gitpod
0 commit comments