bitcoinj/build.Containerfile
Andreas Schildbach bb95ea18d1 build.Containerfile: update reference build to use JDK 17
Also updates the container to Debian Bookworm, because we need
its specific (patched for JDK 17) Gradle version.

Note this change makes the JavaDoc build artifact reproducible.
2023-09-21 19:12:45 +02:00

53 lines
1.4 KiB
Plaintext

#
# Reproducible reference build
#
# Usage:
#
# buildah build --file build.Containerfile --output <outputdir> .
# or
# podman build --file build.Containerfile --output <outputdir> .
# or
# docker build --file build.Containerfile --output <outputdir> .
#
# The build artifacts are written to the specified output directory.
# To also run tests, add
#
# --build-arg ADDITIONAL_GRADLE_TASK=test
#
# stage: set up debian environment
FROM debian:bookworm-slim AS setup-stage
ENV DEBIAN_FRONTEND noninteractive
RUN /usr/bin/apt-get update && \
/usr/bin/apt-get --yes install openjdk-17-jdk-headless gradle && \
/usr/sbin/adduser --disabled-login --gecos "" builder
# stage: build
FROM setup-stage AS build-stage
ARG ADDITIONAL_GRADLE_TASK=""
# give up privileges
USER builder
WORKDIR /home/builder
# copy project source code
COPY --chown=builder / project/
# build project
RUN /usr/bin/gradle --project-dir project/ \
--no-build-cache --no-daemon --no-parallel \
-Dmaven.repo.local=repo \
clean ${ADDITIONAL_GRADLE_TASK} :bitcoinj-core:publishToMavenLocal :bitcoinj-wallettool:installDist
# stage: export build output
FROM scratch AS export-stage
COPY --from=build-stage \
/home/builder/repo/org/bitcoinj/*/*/*.jar \
/home/builder/repo/org/bitcoinj/*/*/*.pom \
/core/
COPY --from=build-stage \
/home/builder/project/wallettool/build/install/wallet-tool/ \
/wallettool/