Skip to content

Commit 16c4308

Browse files
committed
Fixed 386 build for which the cryptography and lxml wheels are not available.
1 parent 53fe0d9 commit 16c4308

2 files changed

Lines changed: 54 additions & 0 deletions

File tree

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ RUN upx /tmp/go/bin/bcrypt-tool
6767

6868
# Build certbot and its plugins.
6969
FROM alpine:3.23 AS certbot
70+
ARG TARGETPLATFORM
7071
ARG CERTBOT_VERSION
7172
COPY --from=npm /tmp/nginx-proxy-manager-install/opt/nginx-proxy-manager/certbot/dns-plugins.json /build/
7273
COPY src/certbot /build

src/certbot/build.sh

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ fi
3232

3333
apk --no-cache add \
3434
coreutils \
35+
patchelf \
3536
xxhash \
3637
curl \
3738
jq \
@@ -51,6 +52,23 @@ apk --no-cache add \
5152
rust \
5253
cargo \
5354

55+
# Needed to build cryptography wheel (linux/386).
56+
if [ "$TARGETPLATFORM" = "linux/386" ]; then
57+
apk --no-cache add \
58+
openssl-dev \
59+
60+
fi
61+
62+
# Needed to build lxml wheel (linux/386).
63+
if [ "$TARGETPLATFORM" = "linux/386" ]; then
64+
apk --no-cache add \
65+
libxml2-dev \
66+
libxml2-static \
67+
libxslt-dev \
68+
libxslt-static \
69+
70+
fi
71+
5472
#
5573
# Build certbot.
5674
#
@@ -63,6 +81,7 @@ curl -# -L -o /packages/cryptography-46.0.5-cp312-abi3-linux_armv7l.whl \
6381
https://wheels.eeems.codes/cryptography/cryptography-46.0.5-cp312-abi3-linux_armv7l.whl
6482

6583
export OSTYPE='linux-gnu'
84+
export STATIC_DEPS=true # For lxml wheel
6685
mkdir /tmp/certbot-symlinks
6786

6887
log "Installing certbot..."
@@ -144,3 +163,37 @@ while IFS= read -r line; do
144163
fi
145164
done < "$TMP_FILE"
146165
rm -f "$TMP_FILE" /tmp/.seen*
166+
167+
log "Checking libraries dependencies..."
168+
for lib in $(find /opt/certbot/ -type f -name "*.so" -exec patchelf --print-needed {} ';' | sort -u)
169+
do
170+
if [ "$TARGETPLATFORM" = "linux/386" ]; then
171+
case "$lib" in
172+
libgcc_s*)
173+
;;
174+
libc.musl-*)
175+
;;
176+
libffi.so.8)
177+
;;
178+
libcrypto.so.3)
179+
;;
180+
libssl.so.3)
181+
;;
182+
*)
183+
echo "ERROR: New library dependency: $lib"
184+
exit 1
185+
;;
186+
esac
187+
else
188+
case "$lib" in
189+
libgcc_s*)
190+
;;
191+
libc.musl-*)
192+
;;
193+
*)
194+
echo "ERROR: New library dependency: $lib"
195+
exit 1
196+
;;
197+
esac
198+
fi
199+
done

0 commit comments

Comments
 (0)