-
Notifications
You must be signed in to change notification settings - Fork 63
Expand file tree
/
Copy pathDockerfile
More file actions
51 lines (40 loc) · 1.67 KB
/
Copy pathDockerfile
File metadata and controls
51 lines (40 loc) · 1.67 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
# syntax = docker/dockerfile:1.4.0
FROM python:3.13-alpine AS build
ARG PLUGINS="[]"
ARG PLUGIN_NAMES="[]"
ARG LXML="6.0.0"
WORKDIR /app
ENV PYTHONPATH=/app
ENV PATH=/root/.local/bin:/usr/local/bin:/usr/local/sbin:/usr/sbin:/usr/bin:/sbin:/bin
ENV DEBIAN_FRONTEND=noninteractive
ADD https://astral.sh/uv/install.sh /tmp/install-uv.sh
RUN sh /tmp/install-uv.sh && rm /tmp/install-uv.sh
# We're upgrading to edge because lxml comes with its own libxml2 which must match the system version for xmlsec to work
# We can remove this once python ships a docker container with a libxml2 that matches lxml
# Check lxml version with:
# import lxml.etree
# lxml.etree.LIBXML_VERSION
# Alternatively, build lxml from source to link against system libxml2: RUN uv pip install --system --no-binary lxml lxml
RUN --mount=type=cache,target=/var/cache/apk \
apk --update-cache upgrade && \
apk add git libxml2 xmlsec-dev build-base jq curl openssh
RUN uv pip install --system https://github.com/magfest/lxml/releases/download/v$LXML/lxml-$LXML-cp313-cp313-musllinux_1_2_$(uname -m).whl
ADD requirements.txt /app/
RUN uv pip install --system -r requirements.txt
COPY --chmod=755 uber-wrapper.sh /usr/local/bin/
RUN <<EOF cat >> PLUGINS.json
$PLUGINS
EOF
RUN jq -r '.[] | "git clone --depth 1 --branch \(.branch|@sh) \(.repo|@sh) \(.path|@sh)"' PLUGINS.json > install_plugins.sh && \
chmod +x install_plugins.sh && \
./install_plugins.sh
ENV uber_plugins=$PLUGIN_NAMES
FROM build AS test
ADD requirements_test.txt /app/
RUN uv pip install --system -r requirements_test.txt
ADD . /app
CMD ["python3", "-m", "pytest"]
FROM build AS release
ADD . /app
ENTRYPOINT ["/usr/local/bin/uber-wrapper.sh"]
CMD ["uber"]