forked from enchant97/hasty-paste
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
46 lines (27 loc) · 952 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# syntax=docker/dockerfile:1.4
ARG PYTHON_VERSION=3.12
FROM python:${PYTHON_VERSION}-alpine as build-deps
WORKDIR /app
WORKDIR /app
COPY . .
RUN python -m venv .venv
ENV PATH="/app/.venv/bin:$PATH"
RUN --mount=type=cache,target=/root/.cache pip install .
# reduce layers created in final image
FROM scratch as build-content
WORKDIR /app
COPY --from=build-deps --link /app/.venv .venv
COPY paste_bin paste_bin
COPY scripts/* ./
FROM python:${PYTHON_VERSION}-alpine
WORKDIR /app
EXPOSE 8000
ENV PATH="/app/.venv/bin:$PATH"
ENV STORAGE__DISK__PASTE_ROOT="/app/data"
COPY --from=build-content --link /app /app
# ensure that data folder gets created with nobody user
RUN mkdir /app/data && chown -R nobody /app/data
USER nobody:nobody
ENTRYPOINT ["/bin/sh", "entrypoint.sh"]
HEALTHCHECK --interval=1m --start-period=10s \
CMD /bin/sh health-check.sh