Spaces:
Build error
Build error
| FROM alpine:latest | |
| # Install Python, pip, and venv support | |
| RUN apk update && \ | |
| apk add --no-cache python3 py3-pip python3-venv build-base nginx && \ | |
| ln -sf python3 /usr/bin/python | |
| WORKDIR /app | |
| # Create and enable virtual environment | |
| RUN python3 -m venv /venv | |
| ENV PATH="/venv/bin:$PATH" | |
| # Copy code and install Python dependencies into venv | |
| COPY requirements.txt main.py nginx.conf ./ | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Create writable temp dirs for nginx | |
| RUN mkdir -p /tmp/nginx/{client_body_temp,proxy_temp,fastcgi_temp,uwsgi_temp,scgi_temp} \ | |
| && chmod -R 777 /tmp/nginx | |
| EXPOSE 7860 | |
| # Launch both FastAPI (uvicorn) and nginx | |
| CMD ["sh", "-c", "uvicorn main:app --host 127.0.0.1 --port 8000 & nginx -g 'daemon off;'"] | |