# 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 -l /app/libs; java -version 2>&1 | head -n 1; tail -f /dev/null"]
Smoke [PASS]: ls -l /app/libs Smoke [PASS]: java -version 2>&1 | head -n 1 Smoke [FAIL]: sh -lc 'echo Artsfacts:; if [ -d /app/libs ]; then ls -1 /app/libs; else echo no_libs_directory; fi Output: sh: 1: Syntax error: Unterminated quoted string
# 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"]
Concerns: The base image tag 'gradle:jdk25' may not exist or could be deprecated; verify that this tag is available and compatible with the project., The CMD only echoes a message and lists libs; it does not exercise the actual library code. Consider a smoke test that attempts to load or inspect the produced jar to ensure packaging is correct. Smoke [PASS]: ls -la /app/libs Smoke [PASS]: test -d /app/libs && echo LIBS_OK || echo LIBS_MISSING Smoke [PASS]: java -version 2>&1 | head -n 1