diff --git a/api-gateway/Dockerfile b/api-gateway/Dockerfile index a65cb92..d79e028 100644 --- a/api-gateway/Dockerfile +++ b/api-gateway/Dockerfile @@ -11,12 +11,25 @@ COPY transaction-service/pom.xml transaction-service/pom.xml COPY notification-service/pom.xml notification-service/pom.xml COPY api-gateway/pom.xml api-gateway/pom.xml -RUN mvn -q -DskipTests dependency:go-offline -pl ${SERVICE_NAME} -am +RUN mvn -q -DskipTests \ + -Dmaven.wagon.http.retryHandler.count=5 \ + -Dhttps.protocols=TLSv1.2 \ + -Djdk.tls.client.protocols=TLSv1.2 \ + dependency:go-offline -pl ${SERVICE_NAME} -am COPY common-lib/src common-lib/src COPY ${SERVICE_NAME}/src ${SERVICE_NAME}/src -RUN mvn -q -DskipTests package -pl ${SERVICE_NAME} -am +RUN mvn -q -DskipTests \ + -Dmaven.wagon.http.retryHandler.count=5 \ + -Dhttps.protocols=TLSv1.2 \ + -Djdk.tls.client.protocols=TLSv1.2 \ + package -pl ${SERVICE_NAME} -am + +RUN set -eux; \ + JAR="$(find "/workspace/${SERVICE_NAME}/target" -maxdepth 1 -type f -name '*.jar' ! -name '*-plain.jar' | head -n 1)"; \ + test -n "$JAR"; \ + cp "$JAR" "/workspace/${SERVICE_NAME}/target/app.jar" FROM eclipse-temurin:21-jre-jammy AS runtime @@ -28,7 +41,7 @@ RUN groupadd -g 10001 app && useradd -u 10001 -g app -m -s /usr/sbin/nologin app WORKDIR /app -COPY --from=build /workspace/${SERVICE_NAME}/target/*.jar /app/app.jar +COPY --from=build /workspace/${SERVICE_NAME}/target/app.jar /app/app.jar USER app diff --git a/api-gateway/pom.xml b/api-gateway/pom.xml index 44cdf0c..b0f2683 100644 --- a/api-gateway/pom.xml +++ b/api-gateway/pom.xml @@ -7,7 +7,7 @@ com.walletcore walletcore-platform - 0.0.1-SNAPSHOT + 0.0.1 walletcore-api-gateway diff --git a/auth-service/Dockerfile b/auth-service/Dockerfile index a65cb92..d79e028 100644 --- a/auth-service/Dockerfile +++ b/auth-service/Dockerfile @@ -11,12 +11,25 @@ COPY transaction-service/pom.xml transaction-service/pom.xml COPY notification-service/pom.xml notification-service/pom.xml COPY api-gateway/pom.xml api-gateway/pom.xml -RUN mvn -q -DskipTests dependency:go-offline -pl ${SERVICE_NAME} -am +RUN mvn -q -DskipTests \ + -Dmaven.wagon.http.retryHandler.count=5 \ + -Dhttps.protocols=TLSv1.2 \ + -Djdk.tls.client.protocols=TLSv1.2 \ + dependency:go-offline -pl ${SERVICE_NAME} -am COPY common-lib/src common-lib/src COPY ${SERVICE_NAME}/src ${SERVICE_NAME}/src -RUN mvn -q -DskipTests package -pl ${SERVICE_NAME} -am +RUN mvn -q -DskipTests \ + -Dmaven.wagon.http.retryHandler.count=5 \ + -Dhttps.protocols=TLSv1.2 \ + -Djdk.tls.client.protocols=TLSv1.2 \ + package -pl ${SERVICE_NAME} -am + +RUN set -eux; \ + JAR="$(find "/workspace/${SERVICE_NAME}/target" -maxdepth 1 -type f -name '*.jar' ! -name '*-plain.jar' | head -n 1)"; \ + test -n "$JAR"; \ + cp "$JAR" "/workspace/${SERVICE_NAME}/target/app.jar" FROM eclipse-temurin:21-jre-jammy AS runtime @@ -28,7 +41,7 @@ RUN groupadd -g 10001 app && useradd -u 10001 -g app -m -s /usr/sbin/nologin app WORKDIR /app -COPY --from=build /workspace/${SERVICE_NAME}/target/*.jar /app/app.jar +COPY --from=build /workspace/${SERVICE_NAME}/target/app.jar /app/app.jar USER app diff --git a/auth-service/pom.xml b/auth-service/pom.xml index af43f44..e37a9ac 100644 --- a/auth-service/pom.xml +++ b/auth-service/pom.xml @@ -7,7 +7,8 @@ com.walletcore walletcore-platform - 0.0.1-SNAPSHOT + 0.0.1 + ../pom.xml walletcore-auth-service @@ -15,6 +16,13 @@ jar + + + com.walletcore + walletcore-common-lib + ${project.version} + + org.springframework.boot spring-boot-starter diff --git a/common-lib/pom.xml b/common-lib/pom.xml index ffecefa..f4e2aed 100644 --- a/common-lib/pom.xml +++ b/common-lib/pom.xml @@ -7,7 +7,7 @@ com.walletcore walletcore-platform - 0.0.1-SNAPSHOT + 0.0.1 walletcore-common-lib @@ -20,5 +20,10 @@ spring-boot-starter-test test + + + org.springframework.boot + spring-boot-starter-web + diff --git a/infrastructure/docker-readme.md b/infrastructure/docker-readme.md index cc05aa0..0d7082a 100644 --- a/infrastructure/docker-readme.md +++ b/infrastructure/docker-readme.md @@ -127,6 +127,21 @@ From repo root: docker compose -f infrastructure/docker-compose.yml up -d --build ``` +### Option: sequential builds (if `--build` fails due to network) + +If you hit transient network/TLS errors while pulling Maven dependencies during image builds, build each service image one-by-one (this avoids parallel downloads). + +From repo root: + +```bash +docker compose -f infrastructure/docker-compose.yml build walletcore-auth-service +docker compose -f infrastructure/docker-compose.yml build walletcore-wallet-service +docker compose -f infrastructure/docker-compose.yml build walletcore-transaction-service +docker compose -f infrastructure/docker-compose.yml build walletcore-notification-service +docker compose -f infrastructure/docker-compose.yml build walletcore-api-gateway +docker compose -f infrastructure/docker-compose.yml up -d +``` + Stop: ```bash @@ -149,3 +164,10 @@ docker compose -f infrastructure/docker-compose.yml down -v - Use `localhost:29092` from your machine. - Use `kafka:9092` from other containers. +- **View logs for a specific service** + - From repo root: + +```bash +docker compose -f infrastructure/docker-compose.yml logs --tail=50 {service name} +``` + diff --git a/notification-service/Dockerfile b/notification-service/Dockerfile index a65cb92..d79e028 100644 --- a/notification-service/Dockerfile +++ b/notification-service/Dockerfile @@ -11,12 +11,25 @@ COPY transaction-service/pom.xml transaction-service/pom.xml COPY notification-service/pom.xml notification-service/pom.xml COPY api-gateway/pom.xml api-gateway/pom.xml -RUN mvn -q -DskipTests dependency:go-offline -pl ${SERVICE_NAME} -am +RUN mvn -q -DskipTests \ + -Dmaven.wagon.http.retryHandler.count=5 \ + -Dhttps.protocols=TLSv1.2 \ + -Djdk.tls.client.protocols=TLSv1.2 \ + dependency:go-offline -pl ${SERVICE_NAME} -am COPY common-lib/src common-lib/src COPY ${SERVICE_NAME}/src ${SERVICE_NAME}/src -RUN mvn -q -DskipTests package -pl ${SERVICE_NAME} -am +RUN mvn -q -DskipTests \ + -Dmaven.wagon.http.retryHandler.count=5 \ + -Dhttps.protocols=TLSv1.2 \ + -Djdk.tls.client.protocols=TLSv1.2 \ + package -pl ${SERVICE_NAME} -am + +RUN set -eux; \ + JAR="$(find "/workspace/${SERVICE_NAME}/target" -maxdepth 1 -type f -name '*.jar' ! -name '*-plain.jar' | head -n 1)"; \ + test -n "$JAR"; \ + cp "$JAR" "/workspace/${SERVICE_NAME}/target/app.jar" FROM eclipse-temurin:21-jre-jammy AS runtime @@ -28,7 +41,7 @@ RUN groupadd -g 10001 app && useradd -u 10001 -g app -m -s /usr/sbin/nologin app WORKDIR /app -COPY --from=build /workspace/${SERVICE_NAME}/target/*.jar /app/app.jar +COPY --from=build /workspace/${SERVICE_NAME}/target/app.jar /app/app.jar USER app diff --git a/notification-service/pom.xml b/notification-service/pom.xml index f322040..bd0e2e4 100644 --- a/notification-service/pom.xml +++ b/notification-service/pom.xml @@ -7,7 +7,7 @@ com.walletcore walletcore-platform - 0.0.1-SNAPSHOT + 0.0.1 walletcore-notification-service diff --git a/pom.xml b/pom.xml index e13b22b..2851030 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.walletcore walletcore-platform - 0.0.1-SNAPSHOT + 0.0.1 pom WalletCore Platform @@ -51,6 +51,13 @@ org.springframework.boot spring-boot-maven-plugin + + + + repackage + + + diff --git a/transaction-service/Dockerfile b/transaction-service/Dockerfile index a65cb92..d79e028 100644 --- a/transaction-service/Dockerfile +++ b/transaction-service/Dockerfile @@ -11,12 +11,25 @@ COPY transaction-service/pom.xml transaction-service/pom.xml COPY notification-service/pom.xml notification-service/pom.xml COPY api-gateway/pom.xml api-gateway/pom.xml -RUN mvn -q -DskipTests dependency:go-offline -pl ${SERVICE_NAME} -am +RUN mvn -q -DskipTests \ + -Dmaven.wagon.http.retryHandler.count=5 \ + -Dhttps.protocols=TLSv1.2 \ + -Djdk.tls.client.protocols=TLSv1.2 \ + dependency:go-offline -pl ${SERVICE_NAME} -am COPY common-lib/src common-lib/src COPY ${SERVICE_NAME}/src ${SERVICE_NAME}/src -RUN mvn -q -DskipTests package -pl ${SERVICE_NAME} -am +RUN mvn -q -DskipTests \ + -Dmaven.wagon.http.retryHandler.count=5 \ + -Dhttps.protocols=TLSv1.2 \ + -Djdk.tls.client.protocols=TLSv1.2 \ + package -pl ${SERVICE_NAME} -am + +RUN set -eux; \ + JAR="$(find "/workspace/${SERVICE_NAME}/target" -maxdepth 1 -type f -name '*.jar' ! -name '*-plain.jar' | head -n 1)"; \ + test -n "$JAR"; \ + cp "$JAR" "/workspace/${SERVICE_NAME}/target/app.jar" FROM eclipse-temurin:21-jre-jammy AS runtime @@ -28,7 +41,7 @@ RUN groupadd -g 10001 app && useradd -u 10001 -g app -m -s /usr/sbin/nologin app WORKDIR /app -COPY --from=build /workspace/${SERVICE_NAME}/target/*.jar /app/app.jar +COPY --from=build /workspace/${SERVICE_NAME}/target/app.jar /app/app.jar USER app diff --git a/transaction-service/pom.xml b/transaction-service/pom.xml index d6459f0..39bc125 100644 --- a/transaction-service/pom.xml +++ b/transaction-service/pom.xml @@ -7,7 +7,7 @@ com.walletcore walletcore-platform - 0.0.1-SNAPSHOT + 0.0.1 walletcore-transaction-service diff --git a/wallet-service/Dockerfile b/wallet-service/Dockerfile index a65cb92..d79e028 100644 --- a/wallet-service/Dockerfile +++ b/wallet-service/Dockerfile @@ -11,12 +11,25 @@ COPY transaction-service/pom.xml transaction-service/pom.xml COPY notification-service/pom.xml notification-service/pom.xml COPY api-gateway/pom.xml api-gateway/pom.xml -RUN mvn -q -DskipTests dependency:go-offline -pl ${SERVICE_NAME} -am +RUN mvn -q -DskipTests \ + -Dmaven.wagon.http.retryHandler.count=5 \ + -Dhttps.protocols=TLSv1.2 \ + -Djdk.tls.client.protocols=TLSv1.2 \ + dependency:go-offline -pl ${SERVICE_NAME} -am COPY common-lib/src common-lib/src COPY ${SERVICE_NAME}/src ${SERVICE_NAME}/src -RUN mvn -q -DskipTests package -pl ${SERVICE_NAME} -am +RUN mvn -q -DskipTests \ + -Dmaven.wagon.http.retryHandler.count=5 \ + -Dhttps.protocols=TLSv1.2 \ + -Djdk.tls.client.protocols=TLSv1.2 \ + package -pl ${SERVICE_NAME} -am + +RUN set -eux; \ + JAR="$(find "/workspace/${SERVICE_NAME}/target" -maxdepth 1 -type f -name '*.jar' ! -name '*-plain.jar' | head -n 1)"; \ + test -n "$JAR"; \ + cp "$JAR" "/workspace/${SERVICE_NAME}/target/app.jar" FROM eclipse-temurin:21-jre-jammy AS runtime @@ -28,7 +41,7 @@ RUN groupadd -g 10001 app && useradd -u 10001 -g app -m -s /usr/sbin/nologin app WORKDIR /app -COPY --from=build /workspace/${SERVICE_NAME}/target/*.jar /app/app.jar +COPY --from=build /workspace/${SERVICE_NAME}/target/app.jar /app/app.jar USER app diff --git a/wallet-service/pom.xml b/wallet-service/pom.xml index 90bdc81..f03b6bf 100644 --- a/wallet-service/pom.xml +++ b/wallet-service/pom.xml @@ -7,7 +7,7 @@ com.walletcore walletcore-platform - 0.0.1-SNAPSHOT + 0.0.1 walletcore-wallet-service