Skip to content

Commit

Permalink
build.Containerfile: run the actual build without network access
Browse files Browse the repository at this point in the history
  • Loading branch information
schildbach committed Nov 1, 2024
1 parent e0c20f2 commit bb0f9f3
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions build.Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,23 @@ 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: download dependencies
FROM setup-stage as download-stage

# give up privileges
USER builder
WORKDIR /home/builder

# copy project source code
COPY --chown=builder / project/

# download
RUN /usr/bin/gradle --project-dir project/ \
--no-build-cache --no-daemon --no-parallel \
--settings-file=settings-debian.gradle \
-Dmaven.repo.local=repo \
clean ${ADDITIONAL_GRADLE_TASK} :bitcoinj-base:publishToMavenLocal :bitcoinj-core:publishToMavenLocal :bitcoinj-wallettool:installDist

# stage: build
FROM setup-stage AS build-stage

Expand All @@ -32,12 +49,14 @@ ARG ADDITIONAL_GRADLE_TASK=""
USER builder
WORKDIR /home/builder

# copy project source code
# copy project source code and downloaded repo
COPY --chown=builder / project/
COPY --from=download-stage /home/builder/.gradle /home/builder/.gradle

# build project
RUN /usr/bin/gradle --project-dir project/ \
--no-build-cache --no-daemon --no-parallel \
RUN --network=none \
/usr/bin/gradle --project-dir project/ \
--offline --no-build-cache --no-daemon --no-parallel \
--settings-file=settings-debian.gradle \
-Dmaven.repo.local=repo \
clean ${ADDITIONAL_GRADLE_TASK} :bitcoinj-base:publishToMavenLocal :bitcoinj-core:publishToMavenLocal :bitcoinj-wallettool:installDist
Expand Down

0 comments on commit bb0f9f3

Please sign in to comment.