website / Dockerfile
Andrej Janchevski
fix(deploy): make entrypoint.sh executable in image and git index
0f680ac
# syntax=docker/dockerfile:1.6
# ---- Stage 1: build the Vue SPA ----
FROM node:20-alpine AS frontend
WORKDIR /app
COPY src/frontend/package*.json ./
RUN npm ci
COPY src/frontend ./
RUN npm run build
# ---- Stage 2: backend runtime, mirrors the local website_c mamba env ----
FROM mambaorg/micromamba:1.5.10
USER root
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential libgl1 libglib2.0-0 git curl ca-certificates \
&& rm -rf /var/lib/apt/lists/*
USER $MAMBA_USER
# Conda half: Python 3.9, rdkit, boost, cairo, …
COPY --chown=$MAMBA_USER:$MAMBA_USER environment.yml /tmp/environment.yml
RUN micromamba install -y -n base -f /tmp/environment.yml \
&& micromamba clean --all --yes
ARG MAMBA_DOCKERFILE_ACTIVATE=1
# Pip half: GPU torch (cu118), torch-geometric, Django, DRF, …
COPY --chown=$MAMBA_USER:$MAMBA_USER src/backend/requirements.txt /tmp/requirements.txt
RUN pip install --no-cache-dir \
--extra-index-url https://download.pytorch.org/whl/cu118 \
-r /tmp/requirements.txt
# karateclub 1.3.3 falsely caps numpy<1.23; install without its setup.py
# resolving that, real runtime deps are already covered by requirements.txt.
RUN pip install --no-cache-dir --no-deps karateclub==1.3.3
# Application code + research repo + built SPA
WORKDIR /app
COPY --chown=$MAMBA_USER:$MAMBA_USER src/backend /app/backend
COPY --chown=$MAMBA_USER:$MAMBA_USER src/research /app/research
COPY --chown=$MAMBA_USER:$MAMBA_USER --from=frontend /app/dist /app/backend/dist
COPY --chown=$MAMBA_USER:$MAMBA_USER --chmod=0755 entrypoint.sh /entrypoint.sh
# /app/research is the unified root for code, configs, Loader caches and
# downloaded weights. Already owned by mambauser via the COPY --chown above
# — snapshot_download writes new files into it at runtime.
# Settings.py derives every research path (configs, code, results, weights)
# from these two roots. We unify them — snapshot_download writes new
# checkpoint files into the research tree alongside the bundled code,
# configs and Loader caches. Any mambauser-owned file under /app/research
# is writable at runtime; the read-only image layer holds the originals.
# Override CHECKPOINTS_ROOT (e.g. to /data/checkpoints on a paid HF Space
# with persistent storage) to point downloads elsewhere.
ENV RESEARCH_ROOT=/app/research \
CHECKPOINTS_ROOT=/app/research \
SPA_DIST_DIR=/app/backend/dist \
DJANGO_SETTINGS_MODULE=research_api.settings \
PYTHONUNBUFFERED=1 \
PORT=7860 \
HF_HUB_ENABLE_HF_TRANSFER=1
WORKDIR /app/backend
RUN python manage.py collectstatic --noinput
EXPOSE 7860
ENTRYPOINT ["/usr/local/bin/_entrypoint.sh", "/entrypoint.sh"]