It would be nice, if our Dockerfile would build and jar the services itself, currently it assumes the services are already built and jarred.
Some highly WIP code:
# syntax=docker/dockerfile:experimental
FROM openjdk:11-jdk-slim as build
ARG APPLICATION
ENV ENTRYPOINT_APP_ENV=$APPLICATION
ENV SERVICE=basket
WORKDIR /workspace/app
COPY . /workspace/app
WORKDIR /workspace/app/services
# RUN --mount=type=cache,target=/root/.gradle ./gradlew clean build
RUN ./gradlew clean build
RUN mkdir -p ${SERVICE}/build/dependency && (cd ${SERVICE}/build/dependency; jar -xf ../libs/*.jar)
FROM openjdk:11-jdk-slim
VOLUME /tmp
ARG DEPENDENCY=/workspace/app/services/${SERVICE}/build/dependency
RUN echo "foo"
COPY --from=build ${DEPENDENCY}/BOOT-INF/lib /app/lib
COPY --from=build ${DEPENDENCY}/META-INF /app/META-INF
COPY --from=build ${DEPENDENCY}/BOOT-INF/classes /app
COPY --from=build ${DEPENDENCY}/../../../jni/libmcljava.so /usr/lib/libmcljava.so
ENTRYPOINT java -cp app:app/lib/* ${ENTRYPOINT_APP_ENV}
It would be nice, if our Dockerfile would build and jar the services itself, currently it assumes the services are already built and jarred.
Some highly WIP code: