Skip to content

Commit 9ec8e8c

Browse files
committed
Use deb archive for reproducibility
1 parent 211c516 commit 9ec8e8c

File tree

2 files changed

+36
-15
lines changed

2 files changed

+36
-15
lines changed

Dockerfile

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,26 @@
11
ARG RELEASE="2.8.0"
2+
ARG BUILD="1389"
23
ARG BASE_IMAGE="debian:bookworm-slim"
34

45
FROM ${BASE_IMAGE} AS download_stage
56
ARG RELEASE
7+
ARG BUILD
68

79
RUN apt-get update -y \
810
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
11+
binutils \
912
ca-certificates \
1013
dpkg-dev \
1114
wget \
1215
&& rm -rf /var/lib/apt/lists/*
1316

1417
COPY image-build-helpers/downloader.sh /
1518

16-
RUN /downloader.sh "${RELEASE}" /tmp/sync.tgz
17-
18-
RUN tar -xf /tmp/sync.tgz -C /tmp
19+
RUN /downloader.sh "${RELEASE}" "${BUILD}" \
20+
&& \
21+
test -x /tmp/rslsync \
22+
&& \
23+
test -f /tmp/LICENSE.TXT
1924

2025
FROM ${BASE_IMAGE} AS final-stage
2126

image-build-helpers/downloader.sh

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ set -e
1515
# despite not being linked at the download page
1616

1717
if test -z "$2" ; then
18-
echo "Usage: $0 <RESILIO_SYNC_VERSION> <OUTPUT_TARBALL>" >&2
18+
echo "Usage: $0 <RESILIO_SYNC_VERSION> <BUILD>" >&2
1919
exit 1
2020
fi
2121

2222
RELEASE="$1"
23-
OUTPUT="$2"
23+
BUILD="$2"
2424

2525
ARCHITECTURE=`uname -r`
2626
# Figure out with:
@@ -58,17 +58,16 @@ ARCHITECTURE=`uname -r`
5858
# with <ARCH> one of amd64, arm64, armel, i386
5959
# <OS_ARCH> is armhf for the linux/arm64/v8 images and armel for the linux/arm/v7 images
6060

61-
which dpkg-architecture
61+
which dpkg-architecture >/dev/null
6262

6363
OS_ARCH=`dpkg-architecture 2>/dev/null | grep DEB_HOST_ARCH= | cut -f2 -d=`
6464

6565
case "$OS_ARCH" in
66-
amd64) ARCHITECTURE='x64' ;;
66+
amd64) ARCHITECTURE='amd64' ;;
6767
i386) ARCHITECTURE='i386' ;;
6868
arm64) ARCHITECTURE='arm64' ;;
6969
armhf) ARCHITECTURE='armhf' ;;
70-
# In practice I'm disabling the arm version since both v7l and v8 use armhf
71-
arm|armel|arm*) ARCHITECTURE='arm' ;;
70+
arm|armel|arm*) ARCHITECTURE='armel' ;;
7271
# TODO:
7372
*)
7473
echo "Error, architecture: $OS_ARCH" >&2
@@ -77,14 +76,31 @@ case "$OS_ARCH" in
7776
esac
7877

7978
# See https://www.resilio.com/platforms/desktop/
80-
URL="https://download-cdn.resilio.com/$RELEASE/linux-$ARCHITECTURE/resilio-sync_$ARCHITECTURE.tar.gz"
81-
# NOTE: With 2.8.0 the URL format changes (old versions appear to remain in the old URLs).
82-
# XXX: Will the new url point to whatever is the latest version?
83-
if [ $RELEASE = '2.8.0' ]; then
84-
URL="https://download-cdn.resilio.com/stable/linux/$ARCHITECTURE/0/resilio-sync_$ARCHITECTURE.tar.gz"
85-
fi
79+
#URL="https://download-cdn.resilio.com/$RELEASE/linux-$ARCHITECTURE/resilio-sync_$ARCHITECTURE.tar.gz"
80+
# NOTES:
81+
# - With 2.8.0 the URL format changed (old versions appear to remain in the old URLs).
82+
# - The new url points to whatever is the current latest version
83+
# - Starting with 2.8.1 I use the deb archives instead
84+
URL="https://download-cdn.resilio.com/stable/debian/$ARCHITECTURE/0/resilio-sync_$RELEASE.$BUILD-1_$ARCHITECTURE.deb"
85+
86+
OUTPUT="pkg.deb"
8687

8788
echo "Downloading [$URL]" >&2
8889
wget -O "$OUTPUT" "$URL"
8990

9091
test -f "$OUTPUT"
92+
93+
# Extract contents mimicking the structure of the tarball (and the older docker
94+
# images'): binary and license only
95+
# Note the binary is the same in the deb and tarball
96+
ar x "$OUTPUT"
97+
tar -C /tmp -xf data.tar.* --strip-components 3 ./usr/bin/rslsync
98+
tar -C /tmp -xf data.tar.* --strip-components 5 ./usr/share/doc/resilio-sync/LICENSE.TXT
99+
100+
# Special case
101+
if [ $RELEASE = "2.8.0" ]; then
102+
RELEASE="2.8"
103+
fi
104+
105+
# Validate version
106+
/tmp/rslsync --help 2>&1 | grep -q "Resilio Sync ${RELEASE} (${BUILD})"

0 commit comments

Comments
 (0)