1+ # Dockerfile for SciPy - gitpod-based development
2+ # Usage:
3+ # -------
4+ #
5+ # To make a local build of the container, from the root directory:
6+ # docker build --rm -f "./tools/docker_dev/gitpod.Dockerfile" -t <build-tag> "."
7+ # docker build --rm -f "./tools/docker_dev/gitpod.Dockerfile" -t scipy/scipy-gitpod:latest "." --build-arg BASE_CONTAINER="scipy/scipy-meson:latest" --build-arg CONDA_ENV="scipy-meson" --build-arg BUILD_ARG="python dev.py --build-only -j2"
8+ #
19# Doing a local shallow clone - keeps the container secure
210# and much slimmer than using COPY directly or cloning a remote
11+ # To use the Meson container you'll need to use
12+ # --build-arg BASE_CONTAINER="scipy/scipy-meson:latest"
313ARG BASE_CONTAINER=scipy/scipy-dev:latest
414FROM ${BASE_CONTAINER} as clone
515
@@ -8,20 +18,27 @@ FROM ${BASE_CONTAINER} as clone
818COPY --chown=gitpod . /tmp/scipy_repo
919RUN git clone --depth 1 file:////tmp/scipy_repo /tmp/scipy
1020
21+ # -----------------------------------------------------------------------------
1122# Using the Scipy-dev Docker image as a base
1223# This way, we ensure we have all the needed compilers and dependencies
13- # while reducing the build time
24+ # while reducing the build time - making this a build ARG so we can reuse for other images
25+ # to use the meson image instead --build-arg BASE_CONTAINER="scipy/scipy-meson:latest"
1426ARG BASE_CONTAINER=scipy/scipy-dev:latest
1527FROM ${BASE_CONTAINER} as build
1628
29+ # Build argument - can pass Meson arguments during the build:
30+ # --build-arg BUILD_ARG="python dev.py --build-only -j2"
31+ # --build-arg CONDA_ENV="scipy-meson"
32+ ARG BUILD_ARG="python setup.py build_ext --inplace" \
33+ CONDA_ENV=scipy-dev
34+
1735# -----------------------------------------------------------------------------
1836USER root
1937
2038# -----------------------------------------------------------------------------
2139# ---- ENV variables ----
2240# ---- Directories needed ----
23- ENV WORKSPACE=/workspace/scipy/ \
24- CONDA_ENV=scipy-dev
41+ ENV WORKSPACE=/workspace/scipy/
2542
2643# -----------------------------------------------------------------------------
2744# Change default shell - this avoids issues with Conda later - note we do need
@@ -35,15 +52,18 @@ COPY --from=clone --chown=gitpod /tmp/scipy ${WORKSPACE}
3552
3653WORKDIR ${WORKSPACE}
3754
38- # Build scipy to populate the cache used by ccache
55+ # Build SciPy to populate the cache used by ccache
3956# Must re-activate conda to ensure the ccache flags are picked up
40- RUN git submodule update --init --depth=1 -- scipy/_lib/boost
41- RUN git submodule update --init --depth=1 -- scipy/sparse/linalg/_propack/PROPACK
42- RUN git submodule update --init --depth=1 -- scipy/_lib/unuran
43- RUN git submodule update --init --depth=1 -- scipy/_lib/highs
57+ RUN git submodule update --init --depth=1 -- scipy/_lib/boost &&\
58+ git submodule update --init --depth=1 -- scipy/sparse/linalg/_propack/PROPACK && \
59+ git submodule update --init --depth=1 -- scipy/_lib/unuran && \
60+ git submodule update --init --depth=1 -- scipy/_lib/highs
61+
4462RUN conda activate ${CONDA_ENV} && \
45- python setup.py build_ext --inplace && \
46- ccache -s
63+ ${BUILD_ARG} && \
64+ ccache -s && \
65+ # needed for rst preview in gitpod
66+ python3 -m pip install docutils
4767
4868# Gitpod will load the repository into /workspace/scipy. We remove the
4969# directoy from the image to prevent conflicts
0 commit comments