Sekhar T
Sekhar T

Reputation: 41

Dockerfile that is used for building spring-cloud-dataflow-server image

I have downloaded the Spring cloud Dataflow server code from GitHub at https://github.com/spring-cloud/spring-cloud-dataflow. I am trying to understand how the docker image is build for this server. But I am unable to find dockerfile in this codebase.

Reference documentation section "Adding a Custom JDBC Driver" calls for modifying Pom.xml and rebuild with very little information. I need to use a custom jar and rebuild the image.

Already looked into this post https://github.com/spring-cloud/spring-cloud-dataflow/issues/2489 but I am trying to understand how the orginal image for Spring Dataflow server is built.

Upvotes: 1

Views: 1280

Answers (4)

Zubin Kavarana
Zubin Kavarana

Reputation: 310

Upvoted Ilyaperumal Gopinathan's answer, the best way is to build the project. The fabric8 maven docker plugin requires docker to be installed locally however - surely a lot of work to get to the 4 lines below.

This is the image produced by the 2.7.1 build -

FROM springcloud/baseimage:1.0.0
ENV LANG=C.UTF-8
COPY maven /
VOLUME ["/tmp"]
ENTRYPOINT ["java","-jar","/maven/spring-cloud-dataflow-server.jar"]

The spring cloud base image seems to be simply an Ubuntu base with Java 8 installed (https://github.com/spring-cloud/baseimage)?

Upvotes: 0

Sekhar T
Sekhar T

Reputation: 41

Thanks Gopinathan. I have used the below dockerfile instead of changing the POM.xml and rebuilding the docker image.

FROM mcr.microsoft.com/java/jdk:8u212-zulu-alpine as build
RUN apk add --update \
    curl \
    && rm -rf /var/cache/apk/*

WORKDIR /workspace/app

RUN mkdir target

RUN curl -sS -o /workspace/app/target/spring-cloud-dataflow-server-2.1.2.RELEASE.jar https://repo.spring.io/release/org/springframework/cloud/spring-cloud-dataflow-server/2.1.2.RELEASE/spring-cloud-dataflow-server-2.1.2.RELEASE.jar

RUN curl -sS -o /workspace/app/target/mysql-connector-java-8.0.16.jar https://repo1.maven.org/maven2/mysql/mysql-connector-java/8.0.16/mysql-connector-java-8.0.16.jar

RUN mkdir -p target/dependency && (cd target/dependency; jar -xf ../spring-cloud-dataflow-server-2.1.2.RELEASE.jar)

RUN cp /workspace/app/target/mysql-connector-java-8.0.16.jar /workspace/app/target/dependency/BOOT-INF/lib/  

FROM mcr.microsoft.com/java/jdk:8u212-zulu-alpine
VOLUME /tmp
ARG DEPENDENCY=/workspace/app/target/dependency
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

RUN echo "$(ls -lR /app)"

ENTRYPOINT ["java","-cp","app:app/lib/*","org.springframework.cloud.dataflow.server.single.DataFlowServerApplication"]

Upvotes: 1

Ilayaperumal Gopinathan
Ilayaperumal Gopinathan

Reputation: 4179

The Maven configuration to build the Spring Cloud Data Flow server is here

To build the docker image, you can run the following from your cloned repo (assuming you are on the latest):

./mvnw clean install -DskipTests
./mvnw docker:build -pl spring-cloud-dataflow-server

Upvotes: 3

Sathish Mani
Sathish Mani

Reputation: 11

dockerfile-from-image would help to reverse engineer from docker image.

Upvotes: 0

Related Questions