glibc.Dockerfile 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. # prebuilt image to speed up: ghcr.io/newfuture/nuitka-buider:glibc-master
  2. ARG BUILDER=base-builder
  3. ARG PYTHON_VERSION=3.8
  4. ARG NUITKA_VERSION=main
  5. FROM python:${PYTHON_VERSION}-slim-buster AS base-builder
  6. # 安装必要的依赖
  7. # Use Debian archive for buster
  8. RUN sed -i 's|http://deb.debian.org/debian|http://archive.debian.org/debian|g' /etc/apt/sources.list \
  9. && sed -i '/security.debian.org/d' /etc/apt/sources.list \
  10. && echo 'Acquire::Check-Valid-Until "false";' > /etc/apt/apt.conf.d/99no-check-valid-until
  11. RUN apt-get update && apt-get install -y --no-install-recommends \
  12. ccache \
  13. patchelf \
  14. build-essential \
  15. libffi-dev \
  16. clang \
  17. ca-certificates \
  18. && apt-get clean \
  19. && rm -rf /var/lib/apt/lists/* /var/cache/* /tmp/* /var/log/*
  20. # 安装Python依赖
  21. ARG NUITKA_VERSION
  22. RUN python3 -m pip install --no-cache-dir --prefer-binary \
  23. "https://github.com/Nuitka/Nuitka/archive/${NUITKA_VERSION}.zip" \
  24. --disable-pip-version-check \
  25. --break-system-packages \
  26. && rm -rf /var/cache/* /tmp/* /var/log/* /root/.cache
  27. WORKDIR /app
  28. FROM ${BUILDER} AS builder
  29. # 拷贝项目文件
  30. COPY run.py .github/patch.py doc/img/ddns.svg .
  31. COPY ddns ddns
  32. ARG GITHUB_REF_NAME
  33. ENV GITHUB_REF_NAME=${GITHUB_REF_NAME}
  34. RUN python3 patch.py
  35. # 构建二进制文件,glibc arm下编译会报错,
  36. RUN python3 -O -m nuitka run.py \
  37. --remove-output \
  38. --linux-icon=ddns.svg \
  39. $( [ "$(uname -m)" = "aarch64" ] || echo --lto=yes )
  40. RUN cp dist/ddns /bin/ddns && cp dist/ddns /ddns
  41. # export the binary
  42. FROM scratch AS export
  43. COPY --from=builder /ddns /ddns