Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 26 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,32 @@
FROM eclipse-temurin:21-jdk AS build
WORKDIR /app
COPY .mvn/ .mvn/
COPY mvnw pom.xml ./
RUN chmod +x mvnw && ./mvnw -B -q -DskipTests dependency:go-offline

# Fetch Maven here instead of through ./mvnw. The wrapper's download produced a file that
# failed its own SHA-256 check inside this image, so every image build broke. Doing it
# explicitly keeps .mvn/wrapper/maven-wrapper.properties as the single source of truth and
# fails loudly if the artifact ever stops matching the pin.
RUN apt-get update \
&& apt-get install -y --no-install-recommends curl unzip ca-certificates \
&& rm -rf /var/lib/apt/lists/*

COPY .mvn/wrapper/maven-wrapper.properties /tmp/maven-wrapper.properties
RUN set -eux; \
URL="$(sed -n 's/^distributionUrl=//p' /tmp/maven-wrapper.properties | tr -d '[:space:]')"; \
SUM="$(sed -n 's/^distributionSha256Sum=//p' /tmp/maven-wrapper.properties | tr -d '[:space:]')"; \
test -n "$URL"; \
test -n "$SUM"; \
curl -fsSL --retry 3 -o /tmp/maven.zip "$URL"; \
echo "$SUM /tmp/maven.zip" | sha256sum -c -; \
unzip -q /tmp/maven.zip -d /opt; \
ln -sfn "$(echo /opt/apache-maven-*/bin/mvn)" /usr/local/bin/mvn; \
rm -f /tmp/maven.zip /tmp/maven-wrapper.properties; \
mvn -v

COPY pom.xml ./
RUN mvn -B -q -DskipTests dependency:go-offline

COPY src/ src/
RUN ./mvnw -B -q -DskipTests package
RUN mvn -B -q -DskipTests package

FROM eclipse-temurin:21-jre
WORKDIR /app
Expand All @@ -14,7 +36,6 @@ COPY --from=build /app/target/path-*.jar app.jar
# and the generated master key.
RUN groupadd --system --gid 1001 path \
&& useradd --system --uid 1001 --gid path --home-dir /app --shell /usr/sbin/nologin path \
&& mkdir -p /app/data \
&& chown -R path:path /app
USER path

Expand Down
Loading