From e93b149cf92119981448af0dea852f0bf9794e41 Mon Sep 17 00:00:00 2001 From: jade Date: Wed, 15 Jul 2026 08:59:58 +0900 Subject: [PATCH] feat(infra): add multi-stage dockerfiles for PaaS deployment --- axhub-gateway/Dockerfile | 17 +++++++++++++++-- axhub-tool-email/Dockerfile | 18 ++++++++++++++++-- axhub-tool-other/Dockerfile | 18 ++++++++++++++++-- axhub-tool-payment/Dockerfile | 18 ++++++++++++++++-- axhub-tool-sms/Dockerfile | 18 ++++++++++++++++-- docker-compose.yml | 15 ++++++++++----- 6 files changed, 89 insertions(+), 15 deletions(-) diff --git a/axhub-gateway/Dockerfile b/axhub-gateway/Dockerfile index 26764d7..c9d4673 100644 --- a/axhub-gateway/Dockerfile +++ b/axhub-gateway/Dockerfile @@ -1,4 +1,17 @@ -FROM eclipse-temurin:21-jdk-alpine +FROM eclipse-temurin:21-jdk-alpine AS builder WORKDIR /app -COPY build/libs/axhub-gateway-0.0.1-SNAPSHOT.jar app.jar +COPY gradlew . +COPY gradle gradle +COPY build.gradle settings.gradle ./ +COPY axhub-common axhub-common +COPY axhub-gateway axhub-gateway +RUN chmod +x gradlew +RUN ./gradlew :axhub-gateway:build -x test + +FROM eclipse-temurin:21-jre-alpine +WORKDIR /app +RUN apk add --no-cache tzdata +ENV TZ=Asia/Seoul +COPY --from=builder /app/axhub-gateway/build/libs/*-SNAPSHOT.jar app.jar +EXPOSE 8081 ENTRYPOINT ["java", "-jar", "app.jar"] diff --git a/axhub-tool-email/Dockerfile b/axhub-tool-email/Dockerfile index b88896c..37d7ed2 100644 --- a/axhub-tool-email/Dockerfile +++ b/axhub-tool-email/Dockerfile @@ -1,4 +1,18 @@ -FROM eclipse-temurin:21-jdk-alpine +FROM eclipse-temurin:21-jdk-alpine AS builder WORKDIR /app -COPY build/libs/axhub-tool-email-0.0.1-SNAPSHOT.jar app.jar +COPY gradlew . +COPY gradle gradle +COPY build.gradle settings.gradle ./ +COPY axhub-common axhub-common +COPY axhub-tool-core axhub-tool-core +COPY axhub-tool-email axhub-tool-email +RUN chmod +x gradlew +RUN ./gradlew :axhub-tool-email:build -x test + +FROM eclipse-temurin:21-jre-alpine +WORKDIR /app +RUN apk add --no-cache tzdata +ENV TZ=Asia/Seoul +COPY --from=builder /app/axhub-tool-email/build/libs/*-SNAPSHOT.jar app.jar +EXPOSE 8083 ENTRYPOINT ["java", "-jar", "app.jar"] diff --git a/axhub-tool-other/Dockerfile b/axhub-tool-other/Dockerfile index 9021e9d..00aa79b 100644 --- a/axhub-tool-other/Dockerfile +++ b/axhub-tool-other/Dockerfile @@ -1,4 +1,18 @@ -FROM eclipse-temurin:21-jdk-alpine +FROM eclipse-temurin:21-jdk-alpine AS builder WORKDIR /app -COPY build/libs/axhub-tool-other-0.0.1-SNAPSHOT.jar app.jar +COPY gradlew . +COPY gradle gradle +COPY build.gradle settings.gradle ./ +COPY axhub-common axhub-common +COPY axhub-tool-core axhub-tool-core +COPY axhub-tool-other axhub-tool-other +RUN chmod +x gradlew +RUN ./gradlew :axhub-tool-other:build -x test + +FROM eclipse-temurin:21-jre-alpine +WORKDIR /app +RUN apk add --no-cache tzdata +ENV TZ=Asia/Seoul +COPY --from=builder /app/axhub-tool-other/build/libs/*-SNAPSHOT.jar app.jar +EXPOSE 8084 ENTRYPOINT ["java", "-jar", "app.jar"] diff --git a/axhub-tool-payment/Dockerfile b/axhub-tool-payment/Dockerfile index 04736ff..f40f096 100644 --- a/axhub-tool-payment/Dockerfile +++ b/axhub-tool-payment/Dockerfile @@ -1,4 +1,18 @@ -FROM eclipse-temurin:21-jdk-alpine +FROM eclipse-temurin:21-jdk-alpine AS builder WORKDIR /app -COPY build/libs/axhub-tool-payment-0.0.1-SNAPSHOT.jar app.jar +COPY gradlew . +COPY gradle gradle +COPY build.gradle settings.gradle ./ +COPY axhub-common axhub-common +COPY axhub-tool-core axhub-tool-core +COPY axhub-tool-payment axhub-tool-payment +RUN chmod +x gradlew +RUN ./gradlew :axhub-tool-payment:build -x test + +FROM eclipse-temurin:21-jre-alpine +WORKDIR /app +RUN apk add --no-cache tzdata +ENV TZ=Asia/Seoul +COPY --from=builder /app/axhub-tool-payment/build/libs/*-SNAPSHOT.jar app.jar +EXPOSE 8085 ENTRYPOINT ["java", "-jar", "app.jar"] diff --git a/axhub-tool-sms/Dockerfile b/axhub-tool-sms/Dockerfile index fb83ffb..363700b 100644 --- a/axhub-tool-sms/Dockerfile +++ b/axhub-tool-sms/Dockerfile @@ -1,4 +1,18 @@ -FROM eclipse-temurin:21-jdk-alpine +FROM eclipse-temurin:21-jdk-alpine AS builder WORKDIR /app -COPY build/libs/axhub-tool-sms-0.0.1-SNAPSHOT.jar app.jar +COPY gradlew . +COPY gradle gradle +COPY build.gradle settings.gradle ./ +COPY axhub-common axhub-common +COPY axhub-tool-core axhub-tool-core +COPY axhub-tool-sms axhub-tool-sms +RUN chmod +x gradlew +RUN ./gradlew :axhub-tool-sms:build -x test + +FROM eclipse-temurin:21-jre-alpine +WORKDIR /app +RUN apk add --no-cache tzdata +ENV TZ=Asia/Seoul +COPY --from=builder /app/axhub-tool-sms/build/libs/*-SNAPSHOT.jar app.jar +EXPOSE 8082 ENTRYPOINT ["java", "-jar", "app.jar"] diff --git a/docker-compose.yml b/docker-compose.yml index 818d4d0..48db10d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -13,7 +13,8 @@ services: gateway: build: - context: ./axhub-gateway + context: . + dockerfile: axhub-gateway/Dockerfile ports: - "8281:8081" volumes: @@ -38,7 +39,8 @@ services: tool-sms: build: - context: ./axhub-tool-sms + context: . + dockerfile: axhub-tool-sms/Dockerfile ports: - "8282:8082" depends_on: @@ -58,7 +60,8 @@ services: - GLOW_COMMUNICATION_EAI_PORT=8080 tool-email: build: - context: ./axhub-tool-email + context: . + dockerfile: axhub-tool-email/Dockerfile ports: - "8283:8083" depends_on: @@ -78,7 +81,8 @@ services: - GLOW_COMMUNICATION_EAI_PORT=8080 tool-other: build: - context: ./axhub-tool-other + context: . + dockerfile: axhub-tool-other/Dockerfile ports: - "8284:8084" depends_on: @@ -98,7 +102,8 @@ services: - GLOW_COMMUNICATION_EAI_PORT=8080 tool-payment: build: - context: ./axhub-tool-payment + context: . + dockerfile: axhub-tool-payment/Dockerfile ports: - "8285:8085" depends_on: