From bd3a9b48b252794f9ef2a5658ea56a818681130c Mon Sep 17 00:00:00 2001 From: Ali Naqvi Date: Tue, 9 Jun 2026 09:27:00 +0800 Subject: [PATCH 1/3] feat: [PPT-2525] Update crystal build for unwind support --- Dockerfile | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 62eaab1..1b52a21 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,7 +25,15 @@ RUN adduser \ "${USER}" # Install package updates since image release -RUN apk update && apk --no-cache --quiet upgrade +RUN apk add \ + --update \ + --no-cache \ + libunwind-static \ + libunwind-dev \ + xz-static \ + xz-dev \ + file \ + git # Update CA certificates RUN update-ca-certificates @@ -50,16 +58,25 @@ RUN mkdir -p /app/tmp # Build application RUN PLACE_COMMIT=$PLACE_COMMIT \ PLACE_VERSION=$PLACE_VERSION \ - shards build --production --error-trace --static + shards build \ + --debug \ + --error-trace \ + --no-color \ + --static \ + -O1 \ + --frame-pointers=always \ + --link-flags "-no-pie -Wl,-no-pie -Wl,--eh-frame-hdr -Wl,--build-id -rdynamic -Wl,--export-dynamic -lunwind -llzma" SHELL ["/bin/bash", "-eo", "pipefail", "-c"] # Extract binary dependencies -RUN for binary in "/usr/bin/git" /app/bin/* /usr/libexec/git-core/*; do \ - ldd "$binary" | \ +RUN mkdir -p /app/deps && \ + for binary in "/usr/bin/git" /app/bin/* /usr/libexec/git-core/*; do \ + file "$binary" | grep -q ELF || continue; \ + ldd "$binary" 2>/dev/null | \ tr -s '[:blank:]' '\n' | \ grep '^/' | \ - xargs -I % sh -c 'mkdir -p $(dirname deps%); cp % deps%;' || true; \ + xargs -I % sh -c 'mkdir -p "/app/deps$(dirname %)"; cp "%" "/app/deps%"' || true; \ done RUN git config --system http.sslCAInfo /etc/ssl/certs/ca-certificates.crt @@ -103,8 +120,12 @@ COPY --from=build /usr/bin/git /git COPY --from=build /usr/share/git-core/ /usr/share/git-core/ COPY --from=build /usr/libexec/git-core/ /usr/libexec/git-core/ -# Copy the app into place +# Copy the app and its dependencies into place COPY --from=build /app/deps / + +# Copy the musl dynamic linker (required for dynamically linked binaries like git) +COPY --from=build /lib/ld-musl-* /lib/ + COPY --from=build /app/bin / COPY --from=build --chown=0:0 /app/www /app/www From edb6d75e706c8501cd7abc963bde2fd91f54814e Mon Sep 17 00:00:00 2001 From: Ali Naqvi Date: Tue, 9 Jun 2026 09:36:25 +0800 Subject: [PATCH 2/3] lint: make hadolint happy --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 1b52a21..5470576 100644 --- a/Dockerfile +++ b/Dockerfile @@ -88,7 +88,7 @@ RUN case "${TARGETARCH}" in \ arm64) ARCH=armv8l ;; \ *) echo "Unsupported arch: ${TARGETARCH}" && exit 1 ;; \ esac && \ - wget -O /busybox https://busybox.net/downloads/binaries/1.31.0-defconfig-multiarch-musl/busybox-${ARCH} && \ + wget --progress=dot:giga -O /busybox "https://busybox.net/downloads/binaries/1.31.0-defconfig-multiarch-musl/busybox-${ARCH}" && \ chmod +x /busybox # Build a minimal docker image From e4bbd6ff9ee00cf7556c2a715436ec5290f3ecb3 Mon Sep 17 00:00:00 2001 From: Ali Naqvi Date: Tue, 9 Jun 2026 11:41:12 +0800 Subject: [PATCH 3/3] refactor(Dockerfile): do not install packages which are already installed --- Dockerfile | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5470576..0f6824d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,15 +25,7 @@ RUN adduser \ "${USER}" # Install package updates since image release -RUN apk add \ - --update \ - --no-cache \ - libunwind-static \ - libunwind-dev \ - xz-static \ - xz-dev \ - file \ - git +RUN apk update && apk --no-cache --quiet upgrade # Update CA certificates RUN update-ca-certificates @@ -88,7 +80,7 @@ RUN case "${TARGETARCH}" in \ arm64) ARCH=armv8l ;; \ *) echo "Unsupported arch: ${TARGETARCH}" && exit 1 ;; \ esac && \ - wget --progress=dot:giga -O /busybox "https://busybox.net/downloads/binaries/1.31.0-defconfig-multiarch-musl/busybox-${ARCH}" && \ + wget -q -O /busybox "https://busybox.net/downloads/binaries/1.31.0-defconfig-multiarch-musl/busybox-${ARCH}" && \ chmod +x /busybox # Build a minimal docker image