diff --git a/.gitpod.yml b/.gitpod.yml index 9222639136a17..90448a7cd4c24 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -6,16 +6,23 @@ # images for gitpod pandas are in https://hub.docker.com/r/pandas/pandas-gitpod/tags # we're using the Dockerfile in the base of the repo image: - file: Dockerfile + file: gitpod/gitpod.Dockerfile tasks: - name: Prepare development environment init: | mkdir -p .vscode cp gitpod/settings.json .vscode/settings.json git fetch --tags + conda init + source ~/.bashrc + conda env update --file environment.yml --prune + conda activate pandas-dev python -m pip install -ve . --no-build-isolation --config-settings editable-verbose=true pre-commit install command: | + source ~/.bashrc + conda activate pandas-dev + conda env update --file environment.yml --prune python -m pip install -ve . --no-build-isolation --config-settings editable-verbose=true echo "✨ Pre-build complete! You can close this terminal ✨ " diff --git a/gitpod/gitpod.Dockerfile b/gitpod/gitpod.Dockerfile index ab3f25b231e67..6132f7514908e 100644 --- a/gitpod/gitpod.Dockerfile +++ b/gitpod/gitpod.Dockerfile @@ -1,48 +1,8 @@ -# Doing a local shallow clone - keeps the container secure -# and much slimmer than using COPY directly or making a -# remote clone -ARG BASE_CONTAINER="pandas/pandas-dev:latest" -FROM gitpod/workspace-base:latest as clone +FROM condaforge/miniforge3:23.3.1-1 -# the clone should be deep enough for versioneer to work -RUN git clone https://github.com/pandas-dev/pandas --depth 12 /tmp/pandas +# Init conda and use the speedy libmamba solver +RUN conda init && conda install -n base conda-libmamba-solver && conda config --set solver libmamba -# ----------------------------------------------------------------------------- -# Using the pandas-dev Docker image as a base -# This way, we ensure we have all the needed compilers and dependencies -# while reducing the build time -FROM ${BASE_CONTAINER} as build +# Install dependencies +RUN conda env update --file https://raw.githubusercontent.com/pandas-dev/pandas/main/environment.yml --prune -# ----------------------------------------------------------------------------- -USER root - -# ----------------------------------------------------------------------------- -# ---- ENV variables ---- -# ---- Directories needed ---- -ENV WORKSPACE=/workspace/pandas/ \ - CONDA_ENV=pandas-dev - -# Allows this micromamba.Dockerfile to activate conda environments -SHELL ["/bin/bash", "--login", "-o", "pipefail", "-c"] - -# Copy over the shallow clone -COPY --from=clone --chown=gitpod /tmp/pandas ${WORKSPACE} - -# Everything happens in the /workspace/pandas directory -WORKDIR ${WORKSPACE} - -# Build pandas to populate the cache used by ccache -RUN git config --global --add safe.directory /workspace/pandas -RUN conda activate ${CONDA_ENV} && \ - python -m pip install -e . --no-build-isolation && \ - python setup.py build_ext --inplace && \ - ccache -s - -# Gitpod will load the repository into /workspace/pandas. We remove the -# directory from the image to prevent conflicts -RUN rm -rf ${WORKSPACE} - -# ----------------------------------------------------------------------------- -# Always return to non privileged user -RUN chown -R gitpod:gitpod /home/gitpod/.cache/ -USER gitpod