Files
Amber/Dockerfile.desktop
T
greenart7c3 22659d360c Make the Windows, macOS and Linux installers reproducible too
The installers rebuild the app with jpackage, so the createDistributable
jar fix never reached them. Ship skiko's native library as plain files
copied out of skiko-awt-runtime-*.jar instead of the jar, which Compose
1.12 rewrites with the build time on every OS. On macOS the plugin also
re-zips every jar with the build time: fix those ZIP header times before
the DMG signs the app. Turn off line-ending conversion, which made
Windows checkouts bundle CRLF resources.

desktopdiff.py now also checks .deb/.rpm (with their scripts), .msi and
.exe (files, tables and custom action DLLs, read with msitools) and .dmg,
and prints the bundled JDK with --jdk. Dockerfile.desktop also rebuilds
the .deb and .rpm; the README covers rebuilding on Windows and macOS.
2026-10-25 13:58:33 -03:00

71 lines
3.5 KiB
Desktop File

# Rebuilds a release of the Amber desktop app for Linux x86_64 and compares it
# with the published Amber-X.Y.Z-linux-x86_64.tar.xz, Amber-X.Y.Z-x86_64.AppImage,
# Amber-X.Y.Z-linux-x86_64.deb and Amber-X.Y.Z-linux-x86_64.rpm.
# See "Verifying Reproducibility of Amber Desktop" in README.md.
#
# The app bundles the runtime of the JDK it was built with, so JDK must be
# the Temurin release the published build used (the build stops and names it
# if it isn't).
ARG JDK=21.0.12.1_1
FROM eclipse-temurin:${JDK}-jdk
ARG VERSION
ENV VERSION=${VERSION}
ENV GRADLE_OPTS="-Xmx2048m -Dorg.gradle.daemon=false"
# fakeroot and rpm build the .deb and .rpm; rpm2cpio, cpio and squashfs-tools
# unpack them. The libraries are the ones the app links against: jpackage
# derives the .deb's Depends from the packages that provide them here, as it
# does on the CI runner (desktopdiff.py only notes a different Depends, since
# it moves with the distro's updates).
RUN apt-get update && apt-get install -y \
git curl xz-utils squashfs-tools python3 ca-certificates \
fakeroot rpm rpm2cpio cpio \
libasound2t64 libfontconfig1 libfreetype6 libgl1 libx11-6 libxext6 libxi6 libxrender1 libxtst6 xdg-utils \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
RUN test -n "$VERSION" || { echo "Pass --build-arg VERSION=vX.Y.Z"; exit 1; }
# Download the official release. Installers are named after the plain X.Y.Z
# version (v6.7.0-pre1 ships as 6.7.0).
RUN mkdir -p /official && \
URL=https://github.com/greenart7c3/Amber/releases/download/${VERSION} && \
v=${VERSION#v} && v=${v%%-*} && \
curl -fsSL -o /official/Amber.tar.xz ${URL}/Amber-${v}-linux-x86_64.tar.xz && \
curl -fsSL -o /official/Amber.AppImage ${URL}/Amber-${v}-x86_64.AppImage && \
curl -fsSL -o /official/Amber.deb ${URL}/Amber-${v}-linux-x86_64.deb && \
curl -fsSL -o /official/Amber.rpm ${URL}/Amber-${v}-linux-x86_64.rpm
# The bundled libjvm.so names the JDK the release was built with.
RUN built=$(tar -xJOf /official/Amber.tar.xz Amber/lib/runtime/lib/server/libjvm.so | grep -a -o -m1 'Server VM ([^)]*)' | sed 's/.*(\(.*\))/\1/') && \
here=$(java -XshowSettings:properties -version 2>&1 | sed -n 's/^ *java.runtime.version = //p') && \
if [ "$built" != "$here" ]; then \
tag=$(echo "${built%-LTS}" | tr + _); \
echo "This release was built with JDK $built, this image has $here: rebuild with --build-arg JDK=$tag"; \
exit 1; \
fi
WORKDIR /app
COPY . /app
# Install the verifier before checking out the release: an older tag ships an
# older desktopdiff.py (or none), and verification must use the current one.
RUN install -m 755 desktopdiff.py /usr/local/bin/desktopdiff.py
RUN git checkout ${VERSION}
RUN chmod +x gradlew && touch keystore.properties
# The app image the tarball holds, the AppDir the AppImage is made from, and
# the .deb and .rpm.
RUN ./gradlew :desktop:createDistributable :desktop:packageDeb :desktop:packageRpm --no-daemon
RUN desktop/packaging/linux.sh "${VERSION#v}" /dist
# Compares contents (paths, bytes, symlinks, executable bits), not archive
# bytes: timestamps and owners depend on the machine, not on the build.
CMD desktopdiff.py /official/Amber.tar.xz /app/desktop/build/compose/binaries/main/app/Amber && \
desktopdiff.py /official/Amber.AppImage /app/desktop/build/linux-bundles/Amber.AppDir && \
desktopdiff.py /official/Amber.deb /app/desktop/build/compose/binaries/main/deb/*.deb && \
desktopdiff.py /official/Amber.rpm /app/desktop/build/compose/binaries/main/rpm/*.rpm