Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +43 -12
Dockerfile
CHANGED
|
@@ -1,20 +1,51 @@
|
|
| 1 |
-
FROM python:3.
|
| 2 |
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
-
RUN apt-get update && apt-get install -y \
|
| 6 |
-
|
| 7 |
-
curl \
|
| 8 |
-
git \
|
| 9 |
&& rm -rf /var/lib/apt/lists/*
|
| 10 |
|
| 11 |
-
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
-
EXPOSE
|
| 17 |
|
| 18 |
-
HEALTHCHECK
|
|
|
|
| 19 |
|
| 20 |
-
|
|
|
|
| 1 |
+
FROM python:3.10-slim
|
| 2 |
|
| 3 |
+
ENV PYTHONUNBUFFERED=1 \
|
| 4 |
+
PYTHONDONTWRITEBYTECODE=1 \
|
| 5 |
+
DEBIAN_FRONTEND=noninteractive \
|
| 6 |
+
KMP_DUPLICATE_LIB_OK=TRUE \
|
| 7 |
+
API_URL=http://localhost:8000
|
| 8 |
|
| 9 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 10 |
+
libglib2.0-0 libsm6 libxrender1 libxext6 libgl1 curl supervisor \
|
|
|
|
|
|
|
| 11 |
&& rm -rf /var/lib/apt/lists/*
|
| 12 |
|
| 13 |
+
WORKDIR /app
|
| 14 |
+
|
| 15 |
+
COPY requirements.txt .
|
| 16 |
+
RUN pip install --no-cache-dir --upgrade pip && \
|
| 17 |
+
pip install --no-cache-dir -r requirements.txt
|
| 18 |
+
|
| 19 |
+
COPY . .
|
| 20 |
+
|
| 21 |
+
RUN cat > /etc/supervisor/conf.d/dermAI.conf << 'EOF'
|
| 22 |
+
[supervisord]
|
| 23 |
+
nodaemon=true
|
| 24 |
+
logfile=/tmp/supervisord.log
|
| 25 |
+
pidfile=/tmp/supervisord.pid
|
| 26 |
+
|
| 27 |
+
[program:fastapi]
|
| 28 |
+
command=uvicorn backend.main:app --host 0.0.0.0 --port 8000 --workers 1
|
| 29 |
+
directory=/app/app
|
| 30 |
+
environment=PYTHONPATH="/app"
|
| 31 |
+
autostart=true
|
| 32 |
+
autorestart=true
|
| 33 |
+
stdout_logfile=/tmp/fastapi.log
|
| 34 |
+
stderr_logfile=/tmp/fastapi_err.log
|
| 35 |
|
| 36 |
+
[program:streamlit]
|
| 37 |
+
command=streamlit run Home.py --server.port 7860 --server.address 0.0.0.0 --server.headless true --server.enableCORS false --server.enableXsrfProtection false
|
| 38 |
+
directory=/app/app/frontend
|
| 39 |
+
environment=PYTHONPATH="/app",API_URL="http://localhost:8000"
|
| 40 |
+
autostart=true
|
| 41 |
+
autorestart=true
|
| 42 |
+
stdout_logfile=/tmp/streamlit.log
|
| 43 |
+
stderr_logfile=/tmp/streamlit_err.log
|
| 44 |
+
EOF
|
| 45 |
|
| 46 |
+
EXPOSE 7860
|
| 47 |
|
| 48 |
+
HEALTHCHECK --interval=30s --timeout=10s --start-period=120s --retries=3 \
|
| 49 |
+
CMD curl -f http://localhost:7860/_stcore/health || exit 1
|
| 50 |
|
| 51 |
+
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"]
|