From cf844589a2d61c3828d00adc4a7c703761d6a653 Mon Sep 17 00:00:00 2001 From: Denis Kuchelev Date: Mon, 20 Nov 2023 15:26:54 +0100 Subject: [PATCH] Build storage-service in Docker See #556. --- Makefile | 4 ++-- platform-storage/storage-service/Dockerfile | 13 ++++++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index e9c5bcf9..15a9dae0 100644 --- a/Makefile +++ b/Makefile @@ -37,7 +37,7 @@ build-controller: # see platform-controller/Dockerfile build-storage: - cd platform-storage/storage-service && mvn clean package -U + # see platform-storage/storage-service/Dockerfile build-analysis: cd analysis-component && mvn clean package -U @@ -54,7 +54,7 @@ build-dev-analysis-image: docker build -t hobbitproject/hobbit-analysis-component:dev ./analysis-component build-dev-storage-image: - docker build -t hobbitproject/hobbit-storage-service:dev ./platform-storage/storage-service + docker build -t hobbitproject/hobbit-storage-service:dev --file ./platform-storage/storage-service/Dockerfile . create-networks: @docker network inspect hobbit >/dev/null || (docker network create -d overlay --attachable --subnet 172.16.100.0/24 hobbit && echo "Created network: hobbit") diff --git a/platform-storage/storage-service/Dockerfile b/platform-storage/storage-service/Dockerfile index 299475f3..a3af1ec0 100644 --- a/platform-storage/storage-service/Dockerfile +++ b/platform-storage/storage-service/Dockerfile @@ -1,5 +1,12 @@ -FROM eclipse-temurin:11-focal - -COPY target/storage-service.jar storage-service.jar +FROM maven:3-eclipse-temurin-11 AS build +WORKDIR /usr/src/hobbit-platform +COPY parent-pom/pom.xml parent-pom/ +ARG project=platform-storage/storage-service +COPY ${project}/pom.xml ${project}/ +RUN mvn --file ${project} dependency:go-offline +COPY ${project}/src ${project}/src +RUN mvn --file ${project} -Dmaven.test.skip=true package +FROM eclipse-temurin:11 +COPY --from=build /usr/src/hobbit-platform/platform-storage/storage-service/target/storage-service.jar . CMD ["java", "-cp", "storage-service.jar", "org.hobbit.core.run.ComponentStarter", "org.hobbit.storage.service.StorageService"]