diff --git a/customer-service/.dockerignore b/customer-service/.dockerignore index bed7973..54356c5 100644 --- a/customer-service/.dockerignore +++ b/customer-service/.dockerignore @@ -1,2 +1,2 @@ -* +target/* !target/customer-service-*.jar \ No newline at end of file diff --git a/customer-service/Dockerfile b/customer-service/Dockerfile index c4e0e89..fdbe01c 100644 --- a/customer-service/Dockerfile +++ b/customer-service/Dockerfile @@ -1,4 +1,10 @@ +FROM maven:3.9.3-eclipse-temurin-8-alpine as build +WORKDIR /app +COPY . . +RUN mvn package + FROM openjdk:8-alpine -COPY target/customer-service-*.jar /usr/local/bin/customer-service.jar +COPY --from=build /app/target/customer-service-*.jar /usr/local/bin/customer-service.jar RUN chmod +x /usr/local/bin/customer-service.jar +EXPOSE 8080 ENTRYPOINT ["java", "-jar", "/usr/local/bin/customer-service.jar"] \ No newline at end of file diff --git a/order-service/.dockerignore b/order-service/.dockerignore index 5f30d30..85e47a2 100644 --- a/order-service/.dockerignore +++ b/order-service/.dockerignore @@ -1,2 +1,2 @@ -* +build/* !build/libs/order-service-*.jar \ No newline at end of file diff --git a/order-service/Dockerfile b/order-service/Dockerfile index 5e67556..28346eb 100644 --- a/order-service/Dockerfile +++ b/order-service/Dockerfile @@ -1,4 +1,9 @@ +FROM gradle:6.2.2-jdk8 as build +WORKDIR /app +COPY . . +RUN gradle build --no-daemon -x test + FROM openjdk:8-alpine -COPY build/libs/order-service-*.jar /usr/local/bin/order-service.jar +COPY --from=build /app/build/libs/order-service-*.jar /usr/local/bin/order-service.jar RUN chmod +x /usr/local/bin/order-service.jar ENTRYPOINT ["java", "-jar", "/usr/local/bin/order-service.jar"] \ No newline at end of file diff --git a/product-service/.dockerignore b/product-service/.dockerignore index 99b50e8..64ad851 100644 --- a/product-service/.dockerignore +++ b/product-service/.dockerignore @@ -1,2 +1,2 @@ -* +target/* !target/product-service-*.jar \ No newline at end of file diff --git a/product-service/Dockerfile b/product-service/Dockerfile index 764dc78..06972c3 100644 --- a/product-service/Dockerfile +++ b/product-service/Dockerfile @@ -1,4 +1,9 @@ +FROM maven:3.9.3-eclipse-temurin-8-alpine as build +WORKDIR /app +COPY . . +RUN mvn package + FROM openjdk:8-alpine -COPY target/product-service-*.jar /usr/local/bin/product-service.jar +COPY --from=build /app/target/product-service-*.jar /usr/local/bin/product-service.jar RUN chmod +x /usr/local/bin/product-service.jar ENTRYPOINT ["java", "-jar", "/usr/local/bin/product-service.jar"] \ No newline at end of file diff --git a/sales-order-system/.dockerignore b/sales-order-system/.dockerignore index 415917a..02018c9 100644 --- a/sales-order-system/.dockerignore +++ b/sales-order-system/.dockerignore @@ -1,5 +1,3 @@ node_modules -public -package* README.md .gitignore \ No newline at end of file diff --git a/sales-order-system/Dockerfile b/sales-order-system/Dockerfile index 404227d..8cb4cc4 100644 --- a/sales-order-system/Dockerfile +++ b/sales-order-system/Dockerfile @@ -1,2 +1,8 @@ +FROM node:16-alpine AS build +WORKDIR /app +COPY . . +RUN npm install +RUN npm run build + FROM httpd:2.4 -COPY ./build /usr/local/apache2/htdocs/ \ No newline at end of file +COPY --from=build /app/build /usr/local/apache2/htdocs/ \ No newline at end of file diff --git a/user-service/.dockerignore b/user-service/.dockerignore index ce1b255..cd222fe 100644 --- a/user-service/.dockerignore +++ b/user-service/.dockerignore @@ -1,2 +1,2 @@ -* +target/* !target/user-service-*.jar \ No newline at end of file diff --git a/user-service/Dockerfile b/user-service/Dockerfile index 7c2af0a..bbea44c 100644 --- a/user-service/Dockerfile +++ b/user-service/Dockerfile @@ -1,4 +1,9 @@ +FROM maven:3.9.3-eclipse-temurin-8-alpine as build +WORKDIR /app +COPY . . +RUN mvn package + FROM openjdk:8-alpine -COPY target/user-service-*.jar /usr/local/bin/user-service.jar +COPY --from=build /app/target/user-service-*.jar /usr/local/bin/user-service.jar RUN chmod +x /usr/local/bin/user-service.jar ENTRYPOINT ["java", "-jar", "/usr/local/bin/user-service.jar"] \ No newline at end of file