Spaces:
Build error
Build error
# Use nginx:alpine to allow apk installs under root | |
FROM nginx:alpine | |
# Install Python + Uvicorn | |
RUN apk update \ | |
&& apk add --no-cache python3 py3-pip \ | |
&& pip3 install --no-cache-dir fastapi uvicorn gradio | |
WORKDIR /app | |
COPY main.py requirements.txt nginx.conf ./ | |
# Create temp dirs and adjust permissions | |
RUN mkdir -p /tmp/nginx/{client_body_temp,proxy_temp,fastcgi_temp,uwsgi_temp,scgi_temp} \ | |
&& chmod -R 777 /tmp/nginx | |
EXPOSE 7860 | |
# Run Uvicorn + Nginx together | |
CMD ["sh", "-c", "python3 -m uvicorn main:app --host 127.0.0.1 --port 8000 & nginx -g 'daemon off;'"] | |