-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
34 lines (22 loc) · 1.05 KB
/
Copy pathDockerfile
File metadata and controls
34 lines (22 loc) · 1.05 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
FROM python:3.12-slim AS builder
WORKDIR /app
COPY pyproject.toml README.md ./
COPY underwrite/ underwrite/
RUN pip install --no-cache-dir build && \
pip install --no-cache-dir cryptography pydantic typer && \
SETUPTOOLS_SCM_PRETEND_VERSION=0.1.0 python -m build --wheel && \
WHEEL=$(echo dist/*.whl) && \
pip install --no-cache-dir "${WHEEL}[serve,postgres,otlp]"
FROM python:3.12-slim
RUN addgroup --system --gid 1001 underwrite && \
adduser --system --uid 1001 --ingroup underwrite underwrite
WORKDIR /app
COPY --from=builder /usr/local/lib/python3.12/site-packages /usr/local/lib/python3.12/site-packages
COPY --from=builder /usr/local/bin/underwrite /usr/local/bin/underwrite
RUN mkdir -p /app/data /data && chown underwrite:underwrite /app/data /data
EXPOSE 8080
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8080/healthz')" || exit 1
USER underwrite
ENTRYPOINT ["underwrite"]
CMD ["serve", "--host", "0.0.0.0", "--port", "8080"]