-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
68 lines (54 loc) · 1.57 KB
/
Dockerfile
File metadata and controls
68 lines (54 loc) · 1.57 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
65
66
67
68
# Multi-stage Dockerfile for Sovereign Maps Backend
# Stage 1: Builder
FROM python:3.11-slim AS builder
WORKDIR /build
# Install build tools
# hadolint ignore=DL3008
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
gcc \
curl \
git \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements
COPY requirements.txt .
# Install dependencies
RUN pip install --no-cache-dir --user --no-warn-script-location \
-r requirements.txt || pip install --no-cache-dir --user --no-warn-script-location \
flwr==1.7.0 \
torch==2.1.0 \
torchvision==0.16.0 \
opacus==1.4.0 \
ecdsa==0.18.0 \
cryptography==41.0.7 \
Flask==3.0.0 \
numpy==1.24.3 \
prometheus-client==0.19.0 \
prometheus-flask-exporter==0.23.0 \
requests==2.31.0 \
pydantic==2.5.0 \
google-generativeai==0.3.0
# Stage 2: Runtime
FROM python:3.11-slim
WORKDIR /app
# Copy Python dependencies from builder
COPY --from=builder /root/.local /root/.local
# Set PATH and Python vars
ENV PATH=/root/.local/bin:$PATH
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
# Install runtime dependencies only
# hadolint ignore=DL3008
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
&& rm -rf /var/lib/apt/lists/*
# Copy application code
COPY sovereignmap_production_backend_v2.py .
COPY src/ ./src/
# Health check
HEALTHCHECK --interval=10s --timeout=5s --retries=3 \
CMD curl -f http://localhost:8000/health || exit 1
# Expose ports
EXPOSE 8000 8080
# Run backend
CMD ["python", "sovereignmap_production_backend_v2.py"]