-
Notifications
You must be signed in to change notification settings - Fork 50
Expand file tree
/
Copy pathDockerfile
More file actions
58 lines (43 loc) · 1.83 KB
/
Dockerfile
File metadata and controls
58 lines (43 loc) · 1.83 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
50
51
52
53
54
55
56
57
58
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
# need to install the system dependencies for the python-ldap
RUN apt-get update && \
apt-get install -y --no-install-recommends \
gcc \
libldap2-dev \
libsasl2-dev \
libssl-dev
# Copy the service dependencies
COPY --link --from=libs . libs
COPY --link --from=platform_libs . platform/libs
WORKDIR /platform/services/user_directory
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
# need to install the system dependencies for the python-ldaplibraries
RUN apt-get update && \
apt-get install -y --no-install-recommends \
libsasl2-2 \
libldap-2.5-0 && \
apt clean all && \
rm -rf /var/cache/apt/* && \
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/user_directory /platform/services/user_directory
COPY --link entrypoint.sh /platform/services/user_directory
COPY --link logconfig.ini /platform/services/user_directory
# Place executables in the environment at the front of the path
ENV PATH="/platform/services/user_directory/.venv/bin:$PATH"
WORKDIR /platform/services/user_directory
ENTRYPOINT [ "./entrypoint.sh" ]