hackathon / Dockerfile
MohdUmar0223's picture
Initial commit
c817825
Raw
History Blame Contribute Delete
811 Bytes
FROM python:3.11-slim
# System dependencies for geospatial libs
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
libgdal-dev \
libgeos-dev \
libproj-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /code
# Install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade -r requirements.txt
# Create non-root user (required by HF Spaces)
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH \
HF_HOME=/tmp/hf_cache \
TRANSFORMERS_CACHE=/tmp/hf_cache
WORKDIR $HOME/app
# Copy application code
COPY --chown=user . $HOME/app
# Expose port 7860 (HF Spaces default)
EXPOSE 7860
# Start FastAPI + Gradio server
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]