-
Notifications
You must be signed in to change notification settings - Fork 50
Expand file tree
/
Copy pathDockerfile
More file actions
41 lines (27 loc) · 1.26 KB
/
Dockerfile
File metadata and controls
41 lines (27 loc) · 1.26 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
FROM python:3.10-slim-bookworm@sha256:a02d127ac3e004d100268fcf394e8d673e1f43f2ac84d2f38f7d8345f18890b3 AS base
FROM base AS build
ENV UV_COMPILE_BYTECODE=1 UV_LINK_MODE=copy
# Disable Python downloads, because we want to use the system interpreter
# across both images.
ENV UV_PYTHON_DOWNLOADS=0
# Copy the service dependencies
COPY --link --from=libs . libs
WORKDIR /platform/services/notifier
COPY --link --from=ghcr.io/astral-sh/uv:0.6.12@sha256:515b886e8eb99bcf9278776d8ea41eb4553a794195ef5803aa7ca6258653100d /uv /bin/uv
COPY --link app .
RUN --mount=type=cache,target=/root/.cache/uv \
--mount=type=bind,source=uv.lock,target=uv.lock \
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
uv sync --frozen --no-dev --no-editable
FROM base AS runtime
RUN useradd -l -u 10001 non-root && \
pip3 uninstall -y setuptools pip wheel && \
rm -rf /root/.cache/pip
USER non-root
# Copy the application from the builder
COPY --link --from=build --chown=10001 /platform/services/notifier /platform/services/notifier
COPY --link entrypoint.sh /platform/services/notifier
# Place executables in the environment at the front of the path
ENV PATH="/platform/services/notifier/.venv/bin:$PATH"
WORKDIR /platform/services/notifier
ENTRYPOINT [ "./entrypoint.sh" ]