-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathDockerfile
31 lines (22 loc) · 882 Bytes
/
Dockerfile
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
FROM cgr.dev/chainguard/python:latest-dev@sha256:912ce75048fac19785891f3ab53f4ccd3ac714d920aaf6e5f8919bb25e109126 AS builder
ENV PATH=$PATH:/home/nonroot/.local/bin
COPY . /app
WORKDIR /app
ENV PATH=/home/nonroot/.local/bin:$PATH
# hadolint ignore=DL4006
RUN wget -q -O - https://install.python-poetry.org | python -
RUN poetry install --no-root;
FROM cgr.dev/chainguard/python:latest@sha256:2d14d0505ffe2d03b1cef2675dec60b3d1da3576732a127249058655cecf64dc
USER nonroot
ENV DB_HOST localhost
ENV DB_NAME postgres
ENV DB_USER postgres
ENV DB_PASS postgres
ENV DB_PORT 5432
COPY --from=builder /app /app
COPY --from=builder /home/nonroot /home/nonroot
WORKDIR /app
EXPOSE 8080
ENV PATH=$PATH:/home/nonroot/.local/bin
HEALTHCHECK CMD curl --fail http://localhost:8080/health || exit 1
ENTRYPOINT ["poetry", "run", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8080"]