-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
64 lines (47 loc) · 1.75 KB
/
Copy pathDockerfile
File metadata and controls
64 lines (47 loc) · 1.75 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
# VisaIQ — Production Dockerfile
# Multi-stage build: builder -> runtime (minimal image)
# Final image size target: < 500 MB
# ===== Stage 1: Builder =====
FROM python:3.12-slim AS builder
WORKDIR /build
# Install build tools needed for some ML packages
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 --upgrade pip \
&& pip install --prefix=/install --no-cache-dir -r requirements.txt
# ===== Stage 2: Runtime =====
FROM python:3.12-slim AS runtime
LABEL org.opencontainers.image.title="VisaIQ"
LABEL org.opencontainers.image.description="Visa Processing Intelligence — ML-powered processing time predictor"
LABEL org.opencontainers.image.source="https://github.com/AkshatRaj00/visapredictor"
LABEL org.opencontainers.image.licenses="MIT"
LABEL org.opencontainers.image.authors="Akshat Raj <akshatraj00@github>"
# Security: non-root user
RUN groupadd -r visaiq && useradd -r -g visaiq -d /app -s /sbin/nologin visaiq
WORKDIR /app
# Copy installed packages from builder
COPY --from=builder /install /usr/local
# Copy application source
COPY --chown=visaiq:visaiq . .
# Streamlit config
RUN mkdir -p .streamlit && cat > .streamlit/config.toml <<EOF
[server]
headless = true
port = 8501
enableCORS = false
enableXsrfProtection = true
maxUploadSize = 10
[browser]
gatherUsageStats = false
[logger]
level = "warning"
EOF
USER visaiq
EXPOSE 8501 8001
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8501/_stcore/health')"
# Default: run Streamlit UI
CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]