@@ -50,25 +50,16 @@ RUN mkdir -p /app/tmp
5050# Build application
5151RUN PLACE_COMMIT=$PLACE_COMMIT \
5252 PLACE_VERSION=$PLACE_VERSION \
53- shards build \
54- --debug \
55- --error-trace \
56- --no-color \
57- --static \
58- -O1 \
59- --frame-pointers=always \
60- --link-flags "-no-pie -Wl,-no-pie -Wl,--eh-frame-hdr -Wl,--build-id -rdynamic -Wl,--export-dynamic -lunwind -llzma"
53+ shards build --production --error-trace --static
6154
6255SHELL ["/bin/bash" , "-eo" , "pipefail" , "-c" ]
6356
6457# Extract binary dependencies
65- RUN mkdir -p /app/deps && \
66- for binary in "/usr/bin/git" /app/bin/* /usr/libexec/git-core/*; do \
67- file "$binary" | grep -q ELF || continue; \
68- ldd "$binary" 2>/dev/null | \
58+ RUN for binary in "/usr/bin/git" /app/bin/* /usr/libexec/git-core/*; do \
59+ ldd "$binary" | \
6960 tr -s '[:blank:]' '\n ' | \
7061 grep '^/' | \
71- xargs -I % sh -c 'mkdir -p "/app/deps $(dirname %)" ; cp "%" "/app/ deps%" ' || true; \
62+ xargs -I % sh -c 'mkdir -p $(dirname deps%) ; cp % deps%; ' || true; \
7263 done
7364
7465RUN git config --system http.sslCAInfo /etc/ssl/certs/ca-certificates.crt
@@ -80,7 +71,7 @@ RUN case "${TARGETARCH}" in \
8071 arm64) ARCH=armv8l ;; \
8172 *) echo "Unsupported arch: ${TARGETARCH}" && exit 1 ;; \
8273 esac && \
83- wget -q - O /busybox " https://busybox.net/downloads/binaries/1.31.0-defconfig-multiarch-musl/busybox-${ARCH}" && \
74+ wget -O /busybox https://busybox.net/downloads/binaries/1.31.0-defconfig-multiarch-musl/busybox-${ARCH} && \
8475 chmod +x /busybox
8576
8677# Build a minimal docker image
@@ -112,12 +103,8 @@ COPY --from=build /usr/bin/git /git
112103COPY --from=build /usr/share/git-core/ /usr/share/git-core/
113104COPY --from=build /usr/libexec/git-core/ /usr/libexec/git-core/
114105
115- # Copy the app and its dependencies into place
106+ # Copy the app into place
116107COPY --from=build /app/deps /
117-
118- # Copy the musl dynamic linker (required for dynamically linked binaries like git)
119- COPY --from=build /lib/ld-musl-* /lib/
120-
121108COPY --from=build /app/bin /
122109
123110COPY --from=build --chown=0:0 /app/www /app/www
0 commit comments