krinya's picture
Refactor code structure for improved readability and maintainability
41ca8e9
Raw
History Blame Contribute Delete
654 Bytes
# Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
# you will also find guides on how best to write your Dockerfile
FROM python:3.12-slim
# Set working directory
WORKDIR /app
# Create user
RUN useradd -m -u 1000 user
# Copy dependency files first (for better caching)
COPY --chown=user ./requirements.txt requirements.txt
# Install dependencies using pip (more reliable for HF Spaces)
RUN pip install --no-cache-dir --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt
# Copy application files
COPY --chown=user . /app
# Switch to user
USER user
# Expose port
EXPOSE 7860
# Run the Gradio app
CMD ["python", "app.py"]