d-e-e-k-11's picture
Upload folder using huggingface_hub
90644ee verified
raw
history blame contribute delete
977 Bytes
# Use official Python image
FROM python:3.10-slim
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PORT=7860
# Set working directory
WORKDIR /app
# Install minimal system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
libglib2.0-0 \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# Create a non-root user and set permissions
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
WORKDIR $HOME/app
# Copy requirements and install dependencies
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir --user -r requirements.txt
# Copy application code
COPY --chown=user . .
# Ensure static directories exist
RUN mkdir -p static/uploads
# Expose port
EXPOSE 7860
# Run the application
CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "1", "--threads", "4", "--timeout", "120", "app:app"]