Files
libsignal/java/Dockerfile
Jordan Rose 355e2006c4 Java: update reproducible build to Debian Buster (from Stretch)
The main advantage here is that we don't need any dependencies from
the unstable repo, which means we can be sure that the glibc version
we build against is suitable for Buster instead of being pulled in
from a later train. (We can't do this for Stretch because Stretch is
too old for all our build tools.)

While here, simplify the build a little bit: we're already using
snapshots of the Debian repo, so drop the separate file for pinned
dependencies.
2022-03-24 16:59:36 -07:00

79 lines
2.6 KiB
Docker

#
# Copyright 2020-2021 Signal Messenger, LLC.
# SPDX-License-Identifier: AGPL-3.0-only
#
FROM debian:buster-slim
COPY java/docker/ docker/
COPY java/docker/apt.conf java/docker/sources.list /etc/apt/
# Install tools
RUN apt-get update \
&& apt-get install -y \
apt-transport-https \
build-essential \
git \
curl \
gpg-agent \
openjdk-11-jdk \
openssh-client \
unzip
ARG UID
ARG GID
# Create a user to map the host user to.
RUN groupadd -o -g "${GID}" libsignal \
&& useradd -m -o -u "${UID}" -g "${GID}" -s /bin/bash libsignal
USER libsignal
ENV HOME /home/libsignal
ENV USER libsignal
ENV SHELL /bin/bash
WORKDIR /home/libsignal
# Android SDK setup...
ARG ANDROID_SDK_FILENAME=commandlinetools-linux-7583922_latest.zip
ARG ANDROID_SDK_SHA=124f2d5115eee365df6cf3228ffbca6fc3911d16f8025bebd5b1c6e2fcfa7faf
ARG ANDROID_API_LEVELS=android-30
ARG ANDROID_BUILD_TOOLS_VERSION=30.0.2
ARG NDK_VERSION=21.0.6113669
ENV ANDROID_HOME /home/libsignal/android-sdk
ENV NDK_HOME ${ANDROID_HOME}/ndk/${NDK_VERSION}
ENV PATH ${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools:${ANDROID_HOME}/cmdline-tools/bin
RUN curl -O https://dl.google.com/android/repository/${ANDROID_SDK_FILENAME} \
&& echo "${ANDROID_SDK_SHA} ${ANDROID_SDK_FILENAME}" | sha256sum -c - \
&& unzip -q ${ANDROID_SDK_FILENAME} -d android-sdk \
&& rm -rf ${ANDROID_SDK_FILENAME}
RUN yes | sdkmanager --sdk_root=${ANDROID_HOME} "platforms;${ANDROID_API_LEVELS}" "build-tools;${ANDROID_BUILD_TOOLS_VERSION}" "platform-tools" "ndk;${NDK_VERSION}"
# Rust setup...
COPY rust-toolchain rust-toolchain
ARG RUSTUP_SHA=ad1f8b5199b3b9e231472ed7aa08d2e5d1d539198a15c5b1e53c746aad81d27b
ARG CARGO_NDK_VERSION=1.0.0
ENV PATH="/home/libsignal/.cargo/bin:${PATH}"
RUN curl -f https://static.rust-lang.org/rustup/archive/1.21.1/x86_64-unknown-linux-gnu/rustup-init -o /tmp/rustup-init \
&& echo "${RUSTUP_SHA} /tmp/rustup-init" | sha256sum -c - \
&& chmod a+x /tmp/rustup-init \
&& /tmp/rustup-init -y --profile minimal --default-toolchain "$(cat rust-toolchain)" \
&& rm -rf /tmp/rustup-init
RUN rustup target add armv7-linux-androideabi aarch64-linux-android i686-linux-android x86_64-linux-android \
&& cargo install --version ${CARGO_NDK_VERSION} cargo-ndk
# Pre-download Gradle.
COPY java/gradle gradle
COPY java/gradlew gradlew
RUN ./gradlew --version
# Convert ssh to https for git dependency access without a key.
RUN git config --global url."https://github".insteadOf ssh://git@github
CMD [ "/bin/bash" ]