forked from exercism/kotlin-test-runner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
39 lines (27 loc) · 894 Bytes
/
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
# === Build builder image ===
FROM gradle:8.4.0-jdk11 AS build
WORKDIR /home/builder
# Prepare required project files
COPY src ./src
COPY build.gradle.kts ./
COPY settings.gradle.kts ./
# Build test runner
RUN gradle --no-daemon -i shadowJar \
&& cp build/libs/autotest-runner.jar .
FROM maven:3.8.6-jdk-11-slim AS cache
# Ensure exercise dependencies are downloaded
WORKDIR /opt/exercise
COPY examples/full .
COPY examples/template/pom.xml .
RUN mvn test dependency:go-offline -DexcludeReactor=false
# === Build runtime image ===
FROM maven:3.8.6-jdk-11-slim
WORKDIR /opt/test-runner
# Copy binary and launcher script
COPY bin/ bin/
COPY --from=build /home/builder/autotest-runner.jar ./
# Copy cached dependencies
COPY --from=cache /root/.m2 /root/.m2
# Copy Maven pom.xml
COPY --from=cache /opt/exercise/pom.xml /root/pom.xml
ENTRYPOINT ["sh", "/opt/test-runner/bin/run.sh"]