vondp/TorchCode
0
1FROM python:3.11-slim2 3# Install Node.js 20 for building the JupyterLab extension4RUN apt-get update && \5 apt-get install -y --no-install-recommends ca-certificates curl gnupg && \6 mkdir -p /etc/apt/keyrings && \7 curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key \8 | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \9 echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" \10 > /etc/apt/sources.list.d/nodesource.list && \11 apt-get update && \12 apt-get install -y --no-install-recommends nodejs && \13 rm -rf /var/lib/apt/lists/*14 15RUN useradd -m -u 1000 user16 17RUN pip install --no-cache-dir \18 torch --index-url https://download.pytorch.org/whl/cpu && \19 pip install --no-cache-dir \20 jupyterlab>=4.0 \21 numpy \22 hatch-jupyter-builder>=0.523 24WORKDIR /app25 26COPY torch_judge/ ./torch_judge/27COPY setup.py ./28RUN pip install --no-cache-dir -e .29 30# Build the JupyterLab extension: JS first, then Python install31COPY labextension/ ./labextension/32RUN cd labextension && jlpm install && jlpm run build:prod33RUN cd labextension && pip install --no-cache-dir .34 35COPY templates/ ./templates/36COPY solutions/ ./solutions/37COPY entrypoint.sh ./38RUN chmod +x /app/entrypoint.sh39 40# JupyterLab custom settings: fonts, theme, Simple mode, disable news41COPY jupyter_config/overrides.json /tmp/overrides.json42RUN LAB_DIR=$(jupyter lab path 2>/dev/null | grep "Application" | head -1 | sed 's/.*: *//') && \43 mkdir -p "$LAB_DIR/settings" && \44 cp /tmp/overrides.json "$LAB_DIR/settings/overrides.json" && \45 echo "overrides.json → $LAB_DIR/settings/"46 47RUN mkdir -p /app/notebooks /app/data && \48 chown -R user:user /app49 50USER user51 52ENV PORT=786053EXPOSE 786054 55ENTRYPOINT ["/app/entrypoint.sh"]56 