Skip to content

Commit 5d784d3

Browse files
vorburgeredewit
authored andcommitted
Run build in container - but still cache (fixes #374)
1 parent d6ac66a commit 5d784d3

File tree

6 files changed

+22
-74
lines changed

6 files changed

+22
-74
lines changed

.dockerignore

+4-35
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,5 @@
1-
# No need for the Dockerfile itself, this makes it much faster to make small changes in it
2-
Dockerfile
1+
# https://github.com/containers/common/blob/main/docs/containerignore.5.md
32

4-
# No need to push big ./.git/ into container, it's not required to build
5-
.git
6-
7-
8-
# Keep this in sync with .gitignore:
9-
10-
.settings/
11-
.project
12-
.classpath
13-
14-
bin/
15-
.apt_generated/
16-
xtend-gen/
17-
.rpt2_cache/
18-
.gradle/
19-
build/
20-
out/
21-
.gradletasknamecache
22-
/.nb-gradle/
23-
dist/
24-
25-
.idea/
26-
*.iml
27-
28-
node_modules/
29-
coverage/
30-
*d.ts
31-
32-
web/.vertx/file-cache-*
33-
34-
.vscode/
35-
.history/
36-
.vertx/
3+
# Nothing to ignore, since our
4+
# Dockerfile-build does not actually COPY anything, and
5+
# Dockerfile only COPY specifically what it needs.

Dockerfile

+3-12
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,8 @@
1-
FROM openjdk:11-jdk as build
2-
3-
# https://github.com/nodesource/distributions/blob/master/README.md#installation-instructions
4-
RUN curl -fsSL https://deb.nodesource.com/setup_17.x | bash - && apt install -y nodejs && node --version
5-
6-
RUN mkdir /mods/ && cd /mods/ && curl -sS -L -J -f -O https://github.com/OASIS-learn-study/swissarmyknife-minecraft-server-binaries/raw/master/LuckPerms-Sponge-5.3.98.jar
1+
FROM itzg/minecraft-server:java8-multiarch
72

8-
COPY . /project
9-
WORKDIR /project
10-
RUN ./gradlew build -PexcludeTests="**/SeleniumTest*"
3+
# RUN mkdir /mods/ && cd /mods/ && curl -sS -L -J -f -O https://github.com/OASIS-learn-study/swissarmyknife-minecraft-server-binaries/raw/master/LuckPerms-Sponge-5.3.98.jar
114

12-
# Keep any changes made here strictly in sync with Dockerfile-local
13-
FROM itzg/minecraft-server:java8-multiarch
14-
COPY --from=build /project/web/build/libs/*-all.jar /mods/
5+
COPY web/build/libs/*-all.jar /mods/
156
COPY minecraft-server/* /data-init/
167

178
ENV EULA=TRUE

Dockerfile-build

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM openjdk:11-jdk as build
2+
3+
# https://github.com/nodesource/distributions/blob/master/README.md#installation-instructions
4+
RUN curl -fsSL https://deb.nodesource.com/setup_17.x | bash - && apt install -y nodejs && node --version
5+
6+
WORKDIR /project

Dockerfile-local

-23
This file was deleted.

make

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
set -euox pipefail
3+
4+
podman build -f Dockerfile-build -t minecraft-storeys-maker-build .
5+
podman run --rm -v $PWD:/project:Z -v $HOME/.gradle:/root/.gradle:Z minecraft-storeys-maker-build ./gradlew --no-daemon build -PexcludeTests="**/SeleniumTest*"
6+
7+
# NB --format=docker because the "oci" default looses the mc-health HEALTHCHECK of the parent image
8+
podman build -f Dockerfile --format=docker -t minecraft-storeys-maker .

test

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
#!/usr/bin/env bash
22
set -euox pipefail
33

4-
# https://github.com/OASIS-learn-study/minecraft-storeys-maker#build-it
5-
# NB --format=docker because the "oci" default looses the mc-health HEALTHCHECK of the parent image
6-
./gradlew build
7-
podman build -f Dockerfile-local --format=docker -t minecraft-storeys-maker .
4+
./make
85

96
podman stop --time 7 storeys || true
107

0 commit comments

Comments
 (0)