-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathDockerfile.nobuildkit.arm32
46 lines (38 loc) · 1.48 KB
/
Dockerfile.nobuildkit.arm32
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
FROM python:3.12-slim AS python-base
ENV UV_COMPILE_BYTECODE=1 \
\
PYSETUP_PATH="/opt/pysetup" \
VENV_PATH="/opt/pysetup/.venv"
ENV PATH="$VENV_PATH/bin:$PATH"
FROM python-base AS builder-base
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
build-essential libffi-dev libssl-dev curl ca-certificates
# Installing a cryptography dependency which requires Rust.
# TODO: Enable only for arm/v7
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable
ENV PATH=/root/.cargo/bin:$PATH
ENV PKG_CONFIG_PATH=/usr/lib/arm-linux-gnueabihf/pkgconfig
ENV OPENSSL_LIB_DIR=/usr/lib/arm-linux-gnueabihf
ENV OPENSSL_INCLUDE_DIR=/usr/include/arm-linux-gnueabihf/openssl
WORKDIR $PYSETUP_PATH
ADD https://astral.sh/uv/install.sh /uv-installer.sh
RUN sh /uv-installer.sh && rm /uv-installer.sh
ENV PATH="/root/.local/bin/:$PATH"
COPY uv.lock pyproject.toml ./
RUN uv sync --frozen --no-install-project --no-dev
# [Experimental] Remove unused nicegui libs
ENV NICEGUI_LIB_PATH="$VENV_PATH/lib/python3.12/site-packages/nicegui/elements/lib"
RUN rm -rf "$NICEGUI_LIB_PATH/mermaid/"
RUN rm -rf "$NICEGUI_LIB_PATH/plotly/"
RUN rm -rf "$NICEGUI_LIB_PATH/vanilla-jsoneditor/"
FROM python-base AS production
COPY --from=builder-base $PYSETUP_PATH $PYSETUP_PATH
WORKDIR /app
COPY start.sh .
COPY beaverhabits ./beaverhabits
COPY statics ./statics
RUN chmod -R g+w /app && \
chown -R nobody /app
USER nobody
CMD ["sh", "start.sh", "prd"]