website / Dockerfile
Swapnilbpatil's picture
Update Dockerfile
54d9633 verified
Raw History Blame Contribute Delete
744 Bytes
# Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
FROM python:3.9-slim
# Install dependencies
RUN apt-get update && apt-get install -y \
build-essential \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Create a non-root user
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"
# Set working directory
WORKDIR /app
# Copy requirements first for better caching
COPY --chown=user requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir --upgrade -r requirements.txt
# Copy application code
COPY --chown=user . .
# Create directories for uploads
RUN mkdir -p static/images
# Expose port
EXPOSE 7860
# Command to run the application
CMD ["python", "app.py"]