-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
47 lines (40 loc) · 2.06 KB
/
Dockerfile
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
ARG JDKVERSION=jdk8
FROM jenkins/agent:$JDKVERSION
MAINTAINER [email protected]
USER jenkins
# Prep some basics - make dirs and disable the Gradle daemon (one-time build agents gain nothing from the daemon)
RUN mkdir -p ~/.gradle \
# && echo "org.gradle.daemon=false" >> ~/.gradle/gradle.properties \ # ... unless you have a multi-phase build
&& mkdir ~/ws
# Now grab some source code and run a minimal Gradle build to force fetching of wrappers and any immediate dependencies
RUN cd ~/ws \
&& git clone --depth 1 https://github.com/MovingBlocks/joml-ext.git \
&& cd joml-ext \
&& ./gradlew compileTestJava \
&& rm -rf ~/ws/joml-ext
# This step builds the Terasology engine. As a special step it prepares a "build harness" to build modules standalone
RUN cd ~/ws \
&& git clone --depth 1 https://github.com/MovingBlocks/Terasology.git \
&& cd Terasology \
&& ./gradlew extractNatives extractConfig compileTestJava \
&& mkdir -p ~/ws/harness && mkdir -p ~/ws/harness/build-logic/src \
&& cp gradlew ~/ws/harness \
&& cp -r gradle ~/ws/harness/gradle \
&& cp templates/build.gradle ~/ws/harness \
&& cp -r config ~/ws/harness \
&& cp -r natives ~/ws/harness \
&& cp -r build-logic/src ~/ws/harness/build-logic \
&& cp build-logic/*.kts ~/ws/harness/build-logic \
# This last bit is special and quirky - TODO improve the Terasology module build harness to avoid this
&& echo 'includeBuild("build-logic")' >> ~/ws/harness/settings.gradle \
&& rm -rf ~/ws/Terasology
RUN cd ~/ws \
&& git clone --depth 1 https://github.com/Terasology/Sample.git \
&& cd Sample \
&& cp -r ~/ws/harness/* . \
&& ./gradlew compileTestJava \
# Stop any Gradle daemons running - TODO: should be done after every build? In some cases can be reused during image build, but not later in "real" builds
# && ./gradlew --stop \
&& rm -rf ~/ws/Sample
# Delete the whole Gradle daemon dir - just contains log files and daemon status files we can't use anyway
RUN rm -rf ~/.gradle/daemon