Tas01's picture
Update Dockerfile
4577c44 verified
raw
history blame
748 Bytes
FROM python:3.9-slim
WORKDIR /app
# Install minimal system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
libgl1 \
libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Create cache directory
RUN mkdir -p /app/cache
# Copy application
COPY app.py .
# Set environment variables
ENV PYTHONUNBUFFERED=1
ENV GRADIO_SERVER_NAME="0.0.0.0"
ENV GRADIO_SERVER_PORT=7860
ENV TRANSFORMERS_CACHE=/app/cache
ENV HUGGINGFACE_HUB_CACHE=/app/cache
# Expose port
EXPOSE 7860
# Run as non-root user
RUN useradd -m appuser && chown -R appuser:appuser /app
USER appuser
CMD ["python", "app.py"]