Dockerfile36 lines · 1182 chars # syntax=docker/dockerfile:1
# Stage 1: Build the project from source using Maven with a Java 25 JDK
FROM eclipse-temurin:25-jdk AS builder
WORKDIR /workspace
# Install dependencies needed for Maven and building
RUN apt-get update && apt-get install -y --no-install-recommends \
curl ca-certificates unzip tar \
&& rm -rf /var/lib/apt/lists/*
ENV MAVEN_VERSION=3.9.3
# Install Maven
RUN mkdir -p /usr/share/maven \
&& curl -fsSLo /tmp/maven.tar.gz https://archive.apache.org/dist/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz \
&& tar -xzf /tmp/maven.tar.gz -C /usr/share/maven --strip-components=1 \
&& ln -s /usr/share/maven/bin/mvn /usr/bin/mvn
ENV MAVEN_HOME=/usr/share/maven
ENV PATH="$MAVEN_HOME/bin:$PATH"
# Copy the source code and build the project from source
COPY . .
RUN mvn -B -DskipTests package
# Stage 2: Runtime image
FROM eclipse-temurin:25-jre
WORKDIR /app
# Copy built artifacts from the builder stage
COPY --from=builder /workspace /app
# Default command to keep the container alive and indicate build success
CMD ["bash","-lc","echo 'Activiti multi-module project built from source' && tail -f /dev/null"]