-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
38 lines (30 loc) · 995 Bytes
/
Copy pathDockerfile
File metadata and controls
38 lines (30 loc) · 995 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
# Misdirection Proxy — Production Dockerfile
FROM python:3.12-slim
# System deps
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
&& rm -rf /var/lib/apt/lists/*
# App directory
WORKDIR /app
# Install Python dependencies first (layer caching)
COPY pyproject.toml .
RUN pip install --no-cache-dir -e ".[dev]"
RUN pip install --no-cache-dir gunicorn
# Copy source code
COPY src/ src/
COPY tests/ tests/
# Expose gateway port
EXPOSE 8000
# Health check
HEALTHCHECK --interval=30s --timeout=5s --retries=3 \
CMD curl -f http://localhost:8000/health || exit 1
# Run gateway with Gunicorn + Uvicorn workers
# Workers = (2 x CPU cores) + 1 for optimal throughput
CMD ["gunicorn", "src.misdirection.proxy.gateway:app", \
"--worker-class", "uvicorn.workers.UvicornWorker", \
"--workers", "4", \
"--bind", "0.0.0.0:8000", \
"--timeout", "120", \
"--graceful-timeout", "30", \
"--keep-alive", "5", \
"--access-logfile", "-"]