Routeem / Dockerfile
3hstack's picture
Upload Dockerfile
869ce4e verified
Raw History Blame Contribute Delete
1.02 kB
FROM python:3.11-slim
# build-essential: osmnx pulls geopandas/pyproj/rtree that may need a C toolchain.
# git: Hugging Face injects a `git config` step at the end of every Space build,
# which fails with "git: not found" on slim unless git is installed here.
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
git \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Deps are inlined on purpose -- no requirements.txt to go missing on upload.
RUN pip install --no-cache-dir \
flask==3.0.3 \
gunicorn==22.0.0 \
requests==2.32.3 \
osmnx==2.0.7 \
networkx==3.4.2 \
shapely==2.0.6 \
geopandas==1.0.1
COPY app.py .
# HF Spaces run as a non-root user; only /tmp is writable.
ENV HOME=/tmp \
MPLCONFIGDIR=/tmp/mpl \
XDG_CACHE_HOME=/tmp/cache \
PORT=7860 \
PYTHONUNBUFFERED=1
EXPOSE 7860
CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "1", "--threads", "4", "--timeout", "300", "app:app"]