Spaces:
Build error
Build error
# Single-stage build: Python + Nginx combined | |
FROM python:3.10-slim | |
WORKDIR /app | |
# Install Nginx from Debian repo | |
RUN apt-get update && \ | |
apt-get install -y nginx && \ | |
rm -rf /var/lib/apt/lists/* | |
# Copy app, requirements, and config | |
COPY requirements.txt main.py nginx.conf ./ | |
# Install Python dependencies | |
RUN pip install --no-cache-dir -r requirements.txt | |
# Create writable tmp dirs for nginx | |
RUN mkdir -p /tmp/nginx && \ | |
chown -R www-data:www-data /tmp/nginx | |
EXPOSE 7860 | |
# Start Uvicorn and Nginx together | |
CMD ["sh", "-c", "python -m uvicorn main:app --host 127.0.0.1 --port 8000 & nginx -g 'daemon off;'"] | |