Spaces:
Sleeping
Sleeping
File size: 697 Bytes
3c78b7c a57c7fe 3c78b7c a57c7fe 3c78b7c a57c7fe 3c78b7c a57c7fe 3c78b7c dcb1960 3c78b7c |
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 |
FROM python:3.9-slim
# System dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential gcc libffi-dev libpq-dev curl && \
apt-get clean && rm -rf /var/lib/apt/lists/*
# Set workdir
WORKDIR /app
# Copy requirements and install
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# Copy app code
COPY . .
# Create and switch to non-root user
RUN useradd -m -u 1000 user
USER user
# Set environment
ENV PATH="/home/user/.local/bin:$PATH"
# Expose port
EXPOSE 7860
# Start app with uvicorn
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "2"] |