sand3d-explorer / Dockerfile
Thibault-SF's picture
Sand3D Explorer
e6ba88a
Raw History Blame Contribute Delete
858 Bytes
# Sand3D Explorer on a free CPU Space: FastAPI + a static page, torch CPU for the query encoder.
FROM python:3.11-slim
RUN useradd -m -u 1000 user
ENV HOME=/home/user PATH=/home/user/.local/bin:$PATH PYTHONUNBUFFERED=1 \
HF_HOME=/home/user/.cache/huggingface EXPLORER_DATA=/home/user/data
WORKDIR /home/user/app
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir torch==2.15.0 torchvision==0.29.2 --index-url https://download.pytorch.org/whl/cpu \
&& pip install --no-cache-dir -r requirements.txt
USER user
# the text encoder's weights, fetched at build so a cold start does not wait on them
RUN python -c "import open_clip; open_clip.create_model_and_transforms('ViT-B-32', pretrained='laion2b_s34b_b79k')"
COPY --chown=user . .
EXPOSE 7860
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]