Spaces:
Sleeping
Sleeping
File size: 853 Bytes
a065312 162c4a0 |
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 33 34 35 36 37 38 39 40 41 |
# Use an official Python runtime as a parent image
FROM python:3.9-slim
# Set environment variables
ENV PYTHONUNBUFFERED=1
# Set working directory in container
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
gcc \
python3-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy only the requirements file first
COPY /requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy the server code
COPY / .
# Create storage directories
# Create non-root user and set permissions
RUN useradd -m -u 1000 user
RUN chmod -R 777 /app
# Expose ports
EXPOSE 7860
EXPOSE 8765
# Set environment variable for storage path
ENV STORAGE_PATH=/app/storage
# Run the server using Uvicorn
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--ws", "websockets"]
|