WBS1 / Dockerfile
Factor Studios
Update Dockerfile
42cb2ee verified
raw
history blame contribute delete
988 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
RUN mkdir -p /app/storage/vram_blocks/active \
/app/storage/vram_blocks/archived \
/app/storage/vram_blocks/temp \
/app/storage/gpu_state \
/app/storage/cache
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", "server:app", "--host", "0.0.0.0", "--port", "7860", "--ws", "websockets"]