Dockerfile35 lines · 803 chars # Build Guava from source using Maven on Ubuntu 22.04 with OpenJDK 17
FROM ubuntu:22.04 AS build
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y --no-install-recommends \
openjdk-17-jdk \
maven \
ca-certificates \
curl \
ca-certificates-java \
git && \
rm -rf /var/lib/apt/lists/*
WORKDIR /workspace
COPY . .
# Build the project from source
RUN mvn -B -ntp -DskipTests install -U
# Final runtime image
FROM ubuntu:22.04 AS runtime
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y --no-install-recommends \
openjdk-17-jre-headless && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --from=build /workspace /app
# Provide an interactive shell by default
CMD ["bash"]