-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerFile
More file actions
49 lines (33 loc) · 1.13 KB
/
Copy pathDockerFile
File metadata and controls
49 lines (33 loc) · 1.13 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
FROM python:3.11-slim AS base
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
&& rm -rf /var/lib/apt/lists/*
FROM base AS builder
COPY requirements.txt .
RUN pip install --prefix=/install -r requirements.txt
FROM base AS runtime
COPY --from=builder /install /usr/local
RUN addgroup --system phishguard && \
adduser --system --ingroup phishguard --no-create-home phishguard
COPY --chown=phishguard:phishguard . .
RUN python scripts/train_model.py \
--dataset dataset.csv \
--output phishing_model.joblib \
--log-level INFO
USER phishguard
EXPOSE 5000
HEALTHCHECK --interval=30s --timeout=10s --start-period=15s --retries=3 \
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:5000/health')"
CMD ["gunicorn", \
"--bind", "0.0.0.0:5000", \
"--workers", "2", \
"--threads", "4", \
"--timeout", "120", \
"--access-logfile", "-", \
"--error-logfile", "-", \
"app:create_app()"]