File size: 1,608 Bytes
de93bc1
 
 
 
 
 
 
 
 
 
 
4bb29a4
de93bc1
 
 
4bb29a4
 
 
 
 
 
 
 
 
 
 
de93bc1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d87c106
4bb29a4
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
FROM mambaorg/micromamba:1.5.8
SHELL ["/bin/bash", "-lc"]

USER root
RUN mkdir -p /var/lib/apt/lists/partial && \
    apt-get update && \
    apt-get install -y --no-install-recommends git cmake make g++ && \
    rm -rf /var/lib/apt/lists/*

WORKDIR /work

# 1) Create env first (better cache)
COPY binder/environment.yml /tmp/environment.yml
RUN micromamba env create -f /tmp/environment.yml && micromamba clean -a -y

# 2) Copy the WHOLE Space repo into the image
# This is what makes notebooks/scripts appear in JupyterLab
COPY . /work

# 3) Install Jupyter config + start script
RUN mkdir -p /etc/jupyter && \
    cp /work/jupyter_server_config.py /etc/jupyter/jupyter_server_config.py && \
    chmod +x /work/start.sh

# 4) (Optional) Build StochasticCIL (keep if you need it in the Space)
RUN git clone https://github.com/epapoutsellis/StochasticCIL.git && \
    cd StochasticCIL && \
    git fetch --all --tags && \
    git checkout svrg && \
    git config user.email "hf@local" && \
    git config user.name "HF Build" && \
    (git tag -a v1.0 -m "Version 1.0" || true) && \
    mkdir -p build && cd build && \
    PREFIX="$(micromamba run -n ssp python -c 'import sys, os; print(os.path.dirname(os.path.dirname(sys.executable)))')" && \
    cmake .. -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
      -DCONDA_BUILD=OFF \
      -DCMAKE_BUILD_TYPE=Release \
      -DLIBRARY_LIB="${PREFIX}/lib" \
      -DLIBRARY_INC="${PREFIX}" \
      -DCMAKE_INSTALL_PREFIX="${PREFIX}" \
      -DPython_EXECUTABLE="${PREFIX}/bin/python" && \
    make -j"$(nproc)" && \
    make install

EXPOSE 7860
CMD ["/work/start.sh"]