forked from Netflix/lemur
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
69 lines (52 loc) · 1.84 KB
/
Dockerfile
File metadata and controls
69 lines (52 loc) · 1.84 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
59
60
61
62
63
64
65
66
67
68
69
FROM python:3.10-alpine3.22 AS builder
COPY --from=ghcr.io/astral-sh/uv:0.9 /uv /uvx /bin/
ENV PATH="/root/.local/bin/:$PATH" \
CFLAGS="-Os -fomit-frame-pointer" \
LDFLAGS="-Wl,--strip-all"
WORKDIR /opt/lemur
COPY . .
RUN apk add --update --no-cache --virtual build-dependencies \
curl \
bash \
git \
tar \
musl-dev \
gcc \
openldap-dev \
binutils \
npm \
&& uv sync --no-dev --frozen --compile-bytecode
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN curl -sSL https://github.com/caddyserver/caddy/releases/download/v2.10.2/caddy_2.10.2_linux_amd64.tar.gz | tar xz -C /usr/bin \
&& npm config set cache /tmp/npm-cache \
&& npm install \
&& node_modules/.bin/gulp build \
&& node_modules/.bin/gulp package --urlContextPath="" \
&& rm -rf node_modules bower_components .tmp /tmp/npm-cache \
/usr/lib/python3.10/ensurepip \
/usr/lib/python3.10/idlelib \
/usr/lib/python3.10/test \
/usr/lib/python3.10/lib2to3 \
/usr/lib/python3.10/pydoc_data \
/usr/lib/python3.10/tkinter \
&& strip /usr/bin/caddy \
&& strip /opt/lemur/.venv/lib/python*/site-packages/**/*.so || true \
&& find /opt/lemur/.venv -name "*.so" -exec strip --strip-unneeded {} + || true \
&& apk del build-dependencies
FROM python:3.10-alpine3.22 AS runtime
ENV uid=1337
ENV gid=1337
ENV user=lemur
ENV group=lemur
ENV PATH="/opt/lemur/.venv/bin:${PATH}" \
PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1
RUN apk add --no-cache curl libldap bash openssl
RUN addgroup -S ${group} -g ${gid} \
&& adduser -D -S ${user} -G ${group} -u ${uid}
COPY --from=builder --chown=${uid}:${gid} /opt/lemur /opt/lemur
COPY --from=builder --chown=${uid}:${gid} /usr/bin/caddy /usr/bin/caddy
RUN chmod +x /opt/lemur/docker/entrypoint.sh
USER lemur
EXPOSE 80
ENTRYPOINT ["/opt/lemur/docker/entrypoint.sh"]