File size: 1,024 Bytes
567bad0 869ce4e 567bad0 869ce4e 567bad0 8f17b5a 55251ef 567bad0 8f17b5a 567bad0 8f17b5a | 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 | 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"]
|