mapApp / Dockerfile
mtahan's picture
Initial backend commit
a31fd7f verified
Raw
History Blame Contribute Delete
706 Bytes
# Use a lightweight official Python image
FROM python:3.11-slim
# Set working directory
WORKDIR /code
# Copy requirements and install dependencies
COPY ./requirements.txt /code/requirements.txt
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
# Create a non-root user (Hugging Face requires running as user 1000)
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
# Set working directory inside home for safety
WORKDIR $HOME/app
# Copy application files and grant permissions to the user
COPY --chown=user . $HOME/app
# Hugging Face Spaces exposes port 7860 by default
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]