-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
38 lines (27 loc) · 947 Bytes
/
Dockerfile
File metadata and controls
38 lines (27 loc) · 947 Bytes
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
FROM python:3.12-slim as builder
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends gcc g++ \
&& rm -rf /var/lib/apt/lists/*
COPY requirements.txt .
RUN pip install --no-cache-dir --user -r requirements.txt
FROM python:3.12-slim
WORKDIR /app
COPY --from=builder /root/.local /root/.local
ENV PATH=/root/.local/bin:$PATH
COPY app/ ./app/
COPY scripts/ ./scripts/
COPY data/ ./data/
COPY streamlit_app.py .
COPY entrypoint.sh .
RUN sed -i 's/\r$//' entrypoint.sh && chmod +x entrypoint.sh
# Train models during build to ensure compatibility and existence
RUN python scripts/train.py
RUN mkdir -p ml_reports logs
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
DISABLE_SUPABASE=1
EXPOSE 8000
EXPOSE 8501
HEALTHCHECK --interval=30s --timeout=30s --start-period=30s --retries=3 \
CMD python -c "import requests; requests.get('http://localhost:8000/docs', timeout=5)" || exit 1
CMD ["./entrypoint.sh"]