FServe / Dockerfile
Factor Studios
Create Dockerfile
3aeaefa verified
raw
history blame contribute delete
831 Bytes
# 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"]