-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
71 lines (59 loc) · 1.73 KB
/
Dockerfile
File metadata and controls
71 lines (59 loc) · 1.73 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
70
71
ARG BASE_IMAGE=scratch
# Build stage
FROM ubuntu:20.04 AS builder
# Install packages required for creating the binary and bundling libc
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
ccache \
curl \
git \
libbz2-dev \
libffi-dev \
liblzma-dev \
libncursesw5-dev \
libreadline-dev \
libsqlite3-dev \
libssl-dev \
libxml2-dev \
libxmlsec1-dev \
make \
patchelf \
tk-dev \
xz-utils \
zlib1g-dev \
&& rm -rf /var/lib/apt/lists/*
# Install pyenv
ENV PYENV_ROOT="/opt/pyenv"
ENV PATH="$PYENV_ROOT/bin:$PYENV_ROOT/shims:$PATH"
RUN git clone https://github.com/pyenv/pyenv.git $PYENV_ROOT
# Install Python 3.13
RUN pyenv install 3.13 \
&& pyenv global 3.13
# Upgrade pip and install pyinstaller
RUN pip install --root-user-action=ignore --no-cache-dir --upgrade pip setuptools wheel "nuitka>=2.7.16"
# Copy project files
WORKDIR /app
COPY . .
# Install project dependencies
RUN pip install --root-user-action=ignore --no-cache-dir .
# Build static executable with Nuitka
RUN mkdir dist \
&& nuitka \
--onefile \
--standalone \
--static-libpython=yes \
--lto=yes \
--onefile-no-compression \
--output-dir=dist \
--output-filename=bluebeacon \
src/bluebeacon/cli.py
# Final stage
FROM ${BASE_IMAGE}
# Copy the binary from the build stage
COPY --from=builder --chmod=755 /app/dist/bluebeacon /usr/local/bin/bluebeacon
# Set the healthcheck
HEALTHCHECK --interval=5s --timeout=1s --start-period=120s --retries=3 \
CMD ["/usr/local/bin/bluebeacon", "--java"]