# syntax=docker/dockerfile:1
FROM gradle:jdk25 AS build
WORKDIR /workspace
# Copy project files into the build image
COPY . .
# Ensure Gradle wrapper is executable
RUN chmod +x gradlew
# Build the project from source
RUN ./gradlew build --no-daemon --stacktrace
# ---------------------------------------------------------------------------
# Runtime image: a smaller JRE to run the built library
FROM eclipse-temurin:25-jre
WORKDIR /app
# Copy the built artifacts from the build stage
COPY --from=build /workspace/build/libs /app/libs
# Provide a simple, safe default command. The repository is a Java library,
# so there is typically no runnable main class. This keeps the container alive
# and confirms that the artifact is present.
CMD ["sh","-lc","echo RxJava library built; ls -la /app/libs; java -version 2>&1 | head -n 1"]