get-around-api / Dockerfile
klakenyuo's picture
nginx
d6fe050
Raw
History Blame Contribute Delete
990 Bytes
FROM python:3.10-slim
# Installer Nginx et dépendances
RUN apt update && apt install -y nginx && pip install --no-cache-dir streamlit fastapi uvicorn requests pandas numpy scikit-learn joblib
WORKDIR /app
# Copier les fichiers du projet
COPY app.py /app/
COPY api /app/api
COPY model /app/model
COPY data /app/data
COPY api/requirements.txt ./requirements.txt
COPY nginx.conf /etc/nginx/nginx.conf
# Installer dépendances de l'API
RUN pip install --no-cache-dir -r requirements.txt
RUN mkdir -p /tmp/nginx_client_body /tmp/nginx_proxy /tmp/nginx_fastcgi /tmp/nginx_uwsgi /tmp/nginx_scgi && \
chmod -R 777 /tmp/nginx_*
# Exposer uniquement le port 7860 (reverse proxy Nginx)
EXPOSE 7860
# Lancer tous les services :
# - FastAPI sur 7861
# - Streamlit sur 8501
# - Nginx sur 7860 (reverse proxy)
CMD uvicorn api.app:app --host 0.0.0.0 --port 7861 & \
streamlit run app.py --server.port=8501 --server.address=0.0.0.0 & \
nginx -g "daemon off;" -c /etc/nginx/nginx.conf