-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
52 lines (42 loc) · 2.17 KB
/
Dockerfile
File metadata and controls
52 lines (42 loc) · 2.17 KB
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
# syntax=docker/dockerfile:1.7
# =============================================================================
# java - disinformation network mapping
# =============================================================================
# Multi-stage: maven:3.9-eclipse-temurin-21-alpine builds, jre-alpine runs.
# `latest` resolves via `versions:use-latest-releases` where dependencies exist.
# The Java SDK coordinates are documented, but the scaffold stays build-safe
# while those artifacts finish publishing to Maven Central.
# Samples are copied in so the client can run the planted-cluster demo locally.
# -----------------------------------------------------------------------------
FROM maven:3.9-eclipse-temurin-21-alpine AS build
ARG ARCP_SDK_VERSION=latest
WORKDIR /src
COPY pom.xml ./
COPY src/ ./src/
COPY samples/ ./samples/
# Resolve latest if requested, otherwise pin to the requested version.
RUN if [ "$ARCP_SDK_VERSION" = "latest" ]; then \
mvn -B -q versions:use-latest-releases -DallowSnapshots=false \
-Dincludes=io.agentruntimecontrolprotocol:arcp \
-DgenerateBackupPoms=false; \
else \
mvn -B -q versions:set-property \
-Dproperty=arcp.version -DnewVersion="${ARCP_SDK_VERSION}" \
-DgenerateBackupPoms=false; \
fi
# Stub src so package always succeeds for verify even before code is added.
RUN mkdir -p src/main/java/dev/arcp/example && \
if ! ls src/main/java/dev/arcp/example/*.java >/dev/null 2>&1; then \
printf 'package dev.arcp.example;\npublic class Main { public static void main(String[] a){ System.out.println("arcp java example stub"); } }\n' \
> src/main/java/dev/arcp/example/Main.java; \
fi
RUN mvn -B -q -DskipTests package
# -----------------------------------------------------------------------------
FROM eclipse-temurin:21-jre-alpine AS runtime
RUN apk add --no-cache tini ca-certificates
WORKDIR /app
# `<finalName>` is `arcp-example` and `maven-assembly-plugin` appends
# `-jar-with-dependencies` for the fat-jar descriptor.
COPY --from=build /src/target/arcp-example-jar-with-dependencies.jar /app/arcp-example.jar
ENTRYPOINT ["/sbin/tini", "--"]
CMD ["java", "-jar", "/app/arcp-example.jar"]