Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
zeriyoshi committed Jul 25, 2024
1 parent 800d70b commit 3649df4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
15 changes: 13 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@ ARG DP_PHP_DEB_PACKAGES="libgmp-dev libzip-dev libyaml-dev libzstd-dev libargon2
ARG DP_PHP_CONFIGURE_OPTIONS_APPEND=""
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}"

FROM --platform="${PLATFORM}" golang:latest AS golang

COPY "./dependency_resolve" "/dependency_resolve"

RUN apt-get update && apt-get install -y "binutils" \
&& cd "/dependency_resolve" \
&& go build -o="/usr/local/bin/dependency_resolve" . \
&& cd - \
&& strip --strip-all "/usr/local/bin/dependency_resolve" \
&& dependency_resolve -v

FROM --platform="${PLATFORM}" debian:12

ARG DP_CFLAGS_OPTIMIZE
Expand All @@ -26,7 +37,7 @@ ARG DP_PHP_CONFIGURE_OPTIONS
# base
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
"build-essential" "ca-certificates" "pkg-config" "autoconf" "automake" "bison" "re2c" "curl"
"build-essential" "ca-certificates" "pkg-config" "autoconf" "automake" "bison" "re2c" "curl" "binutils"

# ICU
COPY "third_party/unicode-org/icu" "/build/icu"
Expand Down Expand Up @@ -65,5 +76,5 @@ RUN apt-get update \
&& make install \
&& cd -

COPY --chmod=755 "dependency_resolve/dependency_resolve" "/usr/local/bin/dependency_resolve"
COPY --from=golang "/usr/local/bin/dependency_resolve" "/usr/local/bin/dependency_resolve"
COPY --chmod=755 "distroless_php_add_binary" "/usr/local/bin/distroless_php_add_binary"
2 changes: 1 addition & 1 deletion distroless_php_add_binary
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ for BIN in "${@}"; do
esac
done

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

0 comments on commit 3649df4

Please sign in to comment.