11# parts are copied from Dockerfile
22
33# these need to be defined before any FROM - otherwise, the ARGs expand to empty strings.
4-
5- # pyspy & rbspy, using the same builder for both pyspy and rbspy since they share build dependencies - rust:latest 1.52.1
6- ARG RUST_BUILDER_VERSION=@sha256:9c106c1222abe1450f45774273f36246ebf257623ed51280dbc458632d14c9fc
7- # perf - ubuntu:16.04
8- ARG PERF_BUILDER_UBUNTU=@sha256:d7bb0589725587f2f67d0340edb81fd1fcba6c5f38166639cf2a252c939aa30c
9- # phpspy - ubuntu:20.04
10- ARG PHPSPY_BUILDER_UBUNTU=@sha256:cf31af331f38d1d7158470e095b132acd126a7180a54f263d386da88eb681d93
11- # async-profiler glibc - centos:7, see explanation in Dockerfile
12- ARG AP_BUILDER_CENTOS=@sha256:0f4ec88e21daf75124b8a9e5ca03c37a5e937e0e108a255d890492430789b60e
13- # async-profiler musl build
14- ARG AP_BUILDER_ALPINE=@sha256:69704ef328d05a9f806b6b8502915e6a0a4faa4d72018dc42343f511490daf8a
15- # burn - golang:1.16.3
16- ARG BURN_BUILDER_GOLANG=@sha256:f7d3519759ba6988a2b73b5874b17c5958ac7d0aa48a8b1d84d66ef25fa345f1
17- # bcc & gprofiler - centos:7
18- # CentOS 7 image is used to grab an old version of `glibc` during `pyinstaller` bundling.
19- # this will allow the executable to run on older versions of the kernel, eventually leading to the executable running on a wider range of machines.
20- ARG GPROFILER_BUILDER=@sha256:0f4ec88e21daf75124b8a9e5ca03c37a5e937e0e108a255d890492430789b60e
21- # pyperf - ubuntu 20.04
22- ARG PYPERF_BUILDER_UBUNTU=@sha256:cf31af331f38d1d7158470e095b132acd126a7180a54f263d386da88eb681d93
4+ # see build_x86_64_executable.sh and build_aarch64_executable.sh which define these.
5+ ARG RUST_BUILDER_VERSION
6+ ARG PERF_BUILDER_UBUNTU
7+ ARG PHPSPY_BUILDER_UBUNTU
8+ ARG AP_BUILDER_CENTOS
9+ ARG AP_BUILDER_ALPINE
10+ ARG BURN_BUILDER_GOLANG
11+ ARG GPROFILER_BUILDER
12+ ARG PYPERF_BUILDER_UBUNTU
2313
2414# pyspy & rbspy builder base
2515FROM rust${RUST_BUILDER_VERSION} AS pyspy-rbspy-builder-common
@@ -100,6 +90,14 @@ RUN ./bcc_helpers_build.sh
10090# bcc & gprofiler
10191FROM centos${GPROFILER_BUILDER} AS build-stage
10292
93+ # fix repo links for CentOS 8, and enable powertools (required to download glibc-static)
94+ RUN if grep -q "CentOS Linux 8" /etc/os-release ; then \
95+ sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*; \
96+ sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*; \
97+ yum install -y dnf-plugins-core; \
98+ dnf config-manager --set-enabled powertools; \
99+ fi
100+
103101# bcc part
104102# TODO: copied from the main Dockerfile... but modified a lot. we'd want to share it some day.
105103
@@ -142,7 +140,7 @@ WORKDIR /app
142140
143141RUN yum install -y epel-release
144142RUN yum install -y gcc python3 curl python3-pip patchelf python3-devel upx
145- # needed for aarch64
143+ # needed for aarch64 (for staticx)
146144RUN if [ $(uname -m) = "aarch64" ]; then yum install -y glibc-static zlib-devel.aarch64; fi
147145# needed for aarch64, scons & wheel are needed to build staticx
148146RUN if [ $(uname -m) = "aarch64" ]; then python3 -m pip install 'wheel==0.37.0' 'scons==4.2.0' ; fi
@@ -155,6 +153,13 @@ COPY granulate-utils/granulate_utils granulate-utils/granulate_utils
155153RUN python3 -m pip install -r requirements.txt
156154
157155COPY exe-requirements.txt exe-requirements.txt
156+ # build on centos:8 of Aarch64 requires -lnss_files and -lnss_dns. the files are missing but the symbols
157+ # seem to be provided from another archive (e.g libc.a), so this "fix" bypasses the ld error of "missing -lnss..."
158+ # see https://github.com/JonathonReinhart/staticx/issues/219
159+ RUN if grep -q "CentOS Linux 8" /etc/os-release ; then \
160+ ! test -f /lib64/libnss_files.a && ar rcs /lib64/libnss_files.a && \
161+ ! test -f /lib64/libnss_dns.a && ar rcs /lib64/libnss_dns.a; \
162+ fi
158163RUN python3 -m pip install -r exe-requirements.txt
159164
160165# copy PyPerf and stuff
0 commit comments