Spaces:
Sleeping
Sleeping
File size: 832 Bytes
a3c65e3 5f4e413 fd70d94 a3c65e3 fd70d94 a3c65e3 fd70d94 a3c65e3 fd70d94 fdb1397 fd70d94 a3c65e3 fd70d94 a3c65e3 fd70d94 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# Use Python 3.9 slim base image for a smaller footprint
FROM python:3.11.10
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"
# Set working directory
WORKDIR /app
# Copy requirements.txt first to leverage Docker caching
COPY requirements.txt .
# Upgrade pip and install Python dependencies
RUN pip install --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# Copy the application code
COPY app.py .
# Create directories for image storage
RUN mkdir -p cloud_storage/temp cloud_storage/permanent cloud_storage/thumbs
# Expose port 7860 for Gradio/FastAPI
EXPOSE 7860
# Set environment variables for better Python performance
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
# Run the application with Uvicorn
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |