File: gitpod.Dockerfile

package info (click to toggle)
numpy 1%3A1.24.2-1%2Bdeb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 44,720 kB
  • sloc: ansic: 188,931; python: 156,261; asm: 111,405; javascript: 32,693; cpp: 14,210; f90: 755; sh: 638; fortran: 478; makefile: 292; sed: 140; perl: 34
file content (49 lines) | stat: -rw-r--r-- 1,775 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# Doing a local shallow clone - keeps the container secure
# and much slimmer than using COPY directly or making a 
# remote clone
ARG BASE_CONTAINER="numpy/numpy-dev:latest"
FROM gitpod/workspace-base:latest as clone

COPY --chown=gitpod . /tmp/numpy_repo

# the clone should be deep enough for versioneer to work
RUN git clone --shallow-since=2021-05-22 file:////tmp/numpy_repo /tmp/numpy

# -----------------------------------------------------------------------------
# Using the numpy-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

# -----------------------------------------------------------------------------
USER root

# -----------------------------------------------------------------------------
# ---- ENV variables ----
# ---- Directories needed ----
ENV WORKSPACE=/workspace/numpy/ \
    CONDA_ENV=numpy-dev

# Allows this Dockerfile to activate conda environments
SHELL ["/bin/bash", "--login", "-o", "pipefail", "-c"]

# Copy over the shallow clone
COPY --from=clone --chown=gitpod /tmp/numpy ${WORKSPACE}

# Everything happens in the /workspace/numpy directory
WORKDIR ${WORKSPACE}

# Build numpy to populate the cache used by ccache
RUN git config --global --add safe.directory /workspace/numpy
RUN git submodule update --init --depth=1 -- numpy/core/src/umath/svml
RUN conda activate ${CONDA_ENV} && \ 
    python setup.py build_ext --inplace && \
    ccache -s

# Gitpod will load the repository into /workspace/numpy. We remove the
# directory from the image to prevent conflicts
RUN rm -rf ${WORKSPACE}

# -----------------------------------------------------------------------------
# Always return to non privileged user
USER gitpod