File size: 1,488 Bytes
d4f29d2
864a824
d4f29d2
 
 
 
 
864a824
d4f29d2
 
864a824
 
d4f29d2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
864a824
d4f29d2
 
 
 
 
 
 
 
 
864a824
d4f29d2
864a824
d4f29d2
 
864a824
d4f29d2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
FROM python:3.10-slim

ENV PYTHONUNBUFFERED=1 \
    PYTHONDONTWRITEBYTECODE=1 \
    DEBIAN_FRONTEND=noninteractive \
    KMP_DUPLICATE_LIB_OK=TRUE \
    API_URL=http://localhost:8000

RUN apt-get update && apt-get install -y --no-install-recommends \
    libglib2.0-0 libsm6 libxrender1 libxext6 libgl1 curl supervisor \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app

COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip && \
    pip install --no-cache-dir -r requirements.txt

COPY . .

RUN cat > /etc/supervisor/conf.d/dermAI.conf << 'EOF'
[supervisord]
nodaemon=true
logfile=/tmp/supervisord.log
pidfile=/tmp/supervisord.pid

[program:fastapi]
command=uvicorn backend.main:app --host 0.0.0.0 --port 8000 --workers 1
directory=/app/app
environment=PYTHONPATH="/app"
autostart=true
autorestart=true
stdout_logfile=/tmp/fastapi.log
stderr_logfile=/tmp/fastapi_err.log

[program:streamlit]
command=streamlit run Home.py --server.port 7860 --server.address 0.0.0.0 --server.headless true --server.enableCORS false --server.enableXsrfProtection false
directory=/app/app/frontend
environment=PYTHONPATH="/app",API_URL="http://localhost:8000"
autostart=true
autorestart=true
stdout_logfile=/tmp/streamlit.log
stderr_logfile=/tmp/streamlit_err.log
EOF

EXPOSE 7860

HEALTHCHECK --interval=30s --timeout=10s --start-period=120s --retries=3 \
    CMD curl -f http://localhost:7860/_stcore/health || exit 1

CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"]