# Multi-stage Dockerfile to build RxJava from source and provide a runtime image
FROM openjdk:25-jdk-slim AS builder
# Install required tools for Gradle wrapper and unzip
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y --no-install-recommends \
curl \
ca-certificates \
unzip && \
rm -rf /var/lib/apt/lists/*
WORKDIR /workspace
# Copy the repository source
COPY . .
# Ensure wrapper is executable
RUN chmod +x gradlew
# Build the project from source, skipping tests to speed up image creation
RUN ./gradlew build -x test
# Create a minimal runtime image
FROM openjdk:25-jre-slim
WORKDIR /app
# Copy built artifacts from the builder stage
COPY --from=builder /workspace/build/libs /app/libs
# Default command: drop into a shell for convenience
CMD ["bash"]
# Multi-stage Dockerfile to build RxJava from source and provide a runtime image
FROM openjdk:21-jdk-slim AS builder
# Install required tools for Gradle wrapper and unzip
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y --no-install-recommends \
curl \
ca-certificates \
unzip && \
rm -rf /var/lib/apt/lists/*
WORKDIR /workspace
# Copy the repository source
COPY . .
# Ensure wrapper is executable
RUN chmod +x gradlew
# Build the project from source, skipping tests to speed up image creation
RUN ./gradlew build -x test
# Create a minimal runtime image
FROM openjdk:21-jre-slim
WORKDIR /app
# Copy built artifacts from the builder stage
COPY --from=builder /workspace/build/libs /app/libs
# Default command: drop into a shell for convenience
CMD ["bash"]
# Multi-stage Dockerfile to build RxJava from source and provide a runtime image
FROM openjdk:11-jdk-slim AS builder
# Install required tools for Gradle wrapper
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y --no-install-recommends \
curl \
ca-certificates \
unzip && \
rm -rf /var/lib/apt/lists/*
WORKDIR /workspace
# Copy the repository source
COPY . .
# Ensure wrapper is executable
RUN chmod +x gradlew
# Build the project from source, skipping tests to speed up image creation
RUN ./gradlew build -x test
# Create a minimal runtime image
FROM openjdk:11-jre-slim
WORKDIR /app
# Copy built artifacts from the builder stage
COPY --from=builder /workspace/build/libs /app/libs
# Default command: drop into a shell for convenience
CMD ["bash"]
# Multi-stage Dockerfile to build RxJava from source and provide a runtime image
FROM eclipse-temurin:25-jdk AS builder
# Install required tools for Gradle wrapper and unzip
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y --no-install-recommends \
curl \
ca-certificates \
unzip && \
rm -rf /var/lib/apt/lists/*
WORKDIR /workspace
# Copy the repository source
COPY . .
# Ensure wrapper is executable
RUN chmod +x gradlew
# Build the project from source, skipping tests to speed up image creation
RUN ./gradlew build -x test
# Create a minimal runtime image
FROM eclipse-temurin:25-jre AS runtime
WORKDIR /app
# Copy built artifacts from the builder stage
COPY --from=builder /workspace/build/libs /app/libs
# Default command: drop into a shell for convenience
CMD ["bash"]
Concerns: Final image uses CMD ["bash"] but the base image eclipse-temurin:25-jre may not include bash; this could fail at container start. Consider using sh or installing bash in the final image, or changing CMD., Consider adding a .dockerignore to avoid copying unnecessary files into the build context (e.g., IDE configs, local caches)., The runtime image does not declare a HEALTHCHECK or EXPOSE a port; for a library this is optional, but adding a healthcheck could help with smoke testing. Smoke [PASS]: java -version Smoke [PASS]: ls -1 /app/libs | head -n 1 Smoke [PASS]: ls -A /app/libs >/dev/null 2>&1 && echo libs_present || echo libs_missing