Skip to content

Commit

Permalink
replace nuitka for pyinstaller
Browse files Browse the repository at this point in the history
  • Loading branch information
peters-david committed Jan 30, 2025
1 parent 9235c7a commit 7e415b6
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,22 @@ ENV PYTHONUNBUFFERED=1
FROM base AS builder
# we want always the latest version of fetched apk packages
# hadolint ignore=DL3018
RUN apk add --no-cache build-base openssl-dev glibc-dev posix-libc-utils libffi-dev \
python-3.12 python3-dev py3.12-pip && \
RUN apk add --no-cache build-base posix-libc-utils && \
apk add --no-cache python-3.12 python3-dev py3.12-pip && \
mkdir /install
WORKDIR /install
COPY requirements.txt requirements.txt
# we want always the latest version of fetched pip packages
# hadolint ignore=DL3013
RUN pip3 install --no-cache-dir -U pip setuptools wheel && \
pip3 install --no-cache-dir --prefix=/install --no-warn-script-location -r ./requirements.txt

FROM builder AS native-builder
# we want always the latest version of fetched apk packages
# hadolint ignore=DL3018
RUN apk add --no-cache ccache patchelf
COPY src/ /src/
RUN python -m venv /venv && \
/venv/bin/pip install --no-cache-dir -U pip nuitka setuptools wheel && \
/venv/bin/pip install --no-cache-dir --no-warn-script-location -r ./requirements.txt && \
/venv/bin/python -m nuitka --onefile /src/harbor.py && \
COPY requirements.txt requirements.txt

# use latest version of pyinstaller
# hadolint ignore=DL3013
RUN pip install --no-cache-dir -U pyinstaller && \
pip install --no-cache-dir --no-warn-script-location -r ./requirements.txt && \
pyinstaller --onefile /src/harbor.py && \
pwd && \
ls -lha

Expand All @@ -39,4 +36,4 @@ RUN python3 -m unittest discover -v -s .
# hadolint ignore=DL3007
FROM cgr.dev/chainguard/wolfi-base:latest
USER nonroot
COPY --from=native-builder /install/harbor.bin /usr/local/harbor
COPY --from=native-builder /install/dist/harbor /usr/local/harbor

0 comments on commit 7e415b6

Please sign in to comment.