forked from bitcoinj/bitcoinj
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.Containerfile
52 lines (44 loc) · 1.38 KB
/
build.Containerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#
# 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/