Skip to content

Commit 3649df4

Browse files
committed
wip
1 parent 800d70b commit 3649df4

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

Dockerfile

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,17 @@ ARG DP_PHP_DEB_PACKAGES="libgmp-dev libzip-dev libyaml-dev libzstd-dev libargon2
1111
ARG DP_PHP_CONFIGURE_OPTIONS_APPEND=""
1212
ARG DP_PHP_CONFIGURE_OPTIONS="--enable-bcmath --enable-exif --enable-intl --enable-pcntl --enable-sockets --enable-sysvmsg --enable-sysvsem --enable-sysvshm --with-gmp --with-zip --with-pic --enable-mysqlnd --with-password-argon2 --with-sodium --with-pdo-sqlite=/usr --with-sqlite3=/usr --with-curl --with-iconv --with-openssl --with-readline --with-zlib --disable-phpdbg --disable-cgi --enable-fpm --with-fpm-user=nonroot --with-fpm-group=nonroot ${DP_PHP_CONFIGURE_OPTIONS_APPEND}"
1313

14+
FROM --platform="${PLATFORM}" golang:latest AS golang
15+
16+
COPY "./dependency_resolve" "/dependency_resolve"
17+
18+
RUN apt-get update && apt-get install -y "binutils" \
19+
&& cd "/dependency_resolve" \
20+
&& go build -o="/usr/local/bin/dependency_resolve" . \
21+
&& cd - \
22+
&& strip --strip-all "/usr/local/bin/dependency_resolve" \
23+
&& dependency_resolve -v
24+
1425
FROM --platform="${PLATFORM}" debian:12
1526

1627
ARG DP_CFLAGS_OPTIMIZE
@@ -26,7 +37,7 @@ ARG DP_PHP_CONFIGURE_OPTIONS
2637
# base
2738
RUN apt-get update \
2839
&& apt-get install -y --no-install-recommends \
29-
"build-essential" "ca-certificates" "pkg-config" "autoconf" "automake" "bison" "re2c" "curl"
40+
"build-essential" "ca-certificates" "pkg-config" "autoconf" "automake" "bison" "re2c" "curl" "binutils"
3041

3142
# ICU
3243
COPY "third_party/unicode-org/icu" "/build/icu"
@@ -65,5 +76,5 @@ RUN apt-get update \
6576
&& make install \
6677
&& cd -
6778

68-
COPY --chmod=755 "dependency_resolve/dependency_resolve" "/usr/local/bin/dependency_resolve"
79+
COPY --from=golang "/usr/local/bin/dependency_resolve" "/usr/local/bin/dependency_resolve"
6980
COPY --chmod=755 "distroless_php_add_binary" "/usr/local/bin/distroless_php_add_binary"

distroless_php_add_binary

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ for BIN in "${@}"; do
2020
esac
2121
done
2222

23-
dependency_resolve "/usr/bin/ldd" ${@} | xargs -I {} sh -c 'mkdir -p /rootfs/$(dirname "{}") && cp -apP "{}" /rootfs/{}'
23+
dependency_resolve ${@} | xargs -I {} sh -c 'mkdir -p /rootfs/$(dirname "{}") && cp -apP "{}" "/rootfs/{}" && (strip --strip-all "/rootfs/{}" || true)'

0 commit comments

Comments
 (0)