2023-09-16 15:12:47 +02:00
|
|
|
#
|
|
|
|
# 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
|
2023-09-21 11:56:08 +02:00
|
|
|
FROM debian:bookworm-slim AS setup-stage
|
2023-09-16 15:12:47 +02:00
|
|
|
|
|
|
|
ENV DEBIAN_FRONTEND noninteractive
|
|
|
|
RUN /usr/bin/apt-get update && \
|
2023-09-21 11:56:08 +02:00
|
|
|
/usr/bin/apt-get --yes install openjdk-17-jdk-headless gradle && \
|
2023-09-16 15:12:47 +02:00
|
|
|
/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 \
|
2024-08-26 13:43:44 +02:00
|
|
|
--settings-file=settings-debian.gradle \
|
2023-09-16 15:12:47 +02:00
|
|
|
-Dmaven.repo.local=repo \
|
2024-09-01 21:08:57 +02:00
|
|
|
clean ${ADDITIONAL_GRADLE_TASK} :bitcoinj-base:publishToMavenLocal :bitcoinj-core:publishToMavenLocal :bitcoinj-wallettool:installDist
|
2023-09-16 15:12:47 +02:00
|
|
|
|
|
|
|
# stage: export build output
|
|
|
|
FROM scratch AS export-stage
|
|
|
|
COPY --from=build-stage \
|
2024-09-01 21:08:57 +02:00
|
|
|
/home/builder/repo/org/bitcoinj/bitcoinj-base/*/*.jar \
|
|
|
|
/home/builder/repo/org/bitcoinj/bitcoinj-base/*/*.pom \
|
|
|
|
/base/
|
|
|
|
COPY --from=build-stage \
|
|
|
|
/home/builder/repo/org/bitcoinj/bitcoinj-core/*/*.jar \
|
|
|
|
/home/builder/repo/org/bitcoinj/bitcoinj-core/*/*.pom \
|
2023-09-16 15:12:47 +02:00
|
|
|
/core/
|
|
|
|
COPY --from=build-stage \
|
|
|
|
/home/builder/project/wallettool/build/install/wallet-tool/ \
|
|
|
|
/wallettool/
|