# 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"]