From be900051152ca61ac0ca1c6672e8f89339df7e7b Mon Sep 17 00:00:00 2001 From: TakahashiNguyen Date: Mon, 4 May 2026 03:17:03 +0000 Subject: [PATCH] fix: resolved minor issues (#42) Co-authored-by: TakahashiNg <83152264+TakahashiNguyen@users.noreply.github.com> Reviewed-on: https://git.demonkernel.io.vn/FoodSurf/backend/pulls/42 --- .releaserc.yaml | 2 +- .../src/main/docker/Dockerfile.native | 11 ++++--- .../src/main/docker/Dockerfile.native-micro | 32 ------------------- .../src/main/docker/Dockerfile.native | 11 ++++--- .../src/main/docker/Dockerfile.native-micro | 32 ------------------- .../drinkool/services/EateryServiceTest.java | 1 - .../src/main/docker/Dockerfile.native | 11 ++++--- .../src/main/docker/Dockerfile.native-micro | 32 ------------------- .../drinkool/filters/HeaderRolesFilter.java | 4 +-- 9 files changed, 23 insertions(+), 113 deletions(-) delete mode 100644 account-service/src/main/docker/Dockerfile.native-micro delete mode 100644 eatery-service/src/main/docker/Dockerfile.native-micro delete mode 100644 gateway-service/src/main/docker/Dockerfile.native-micro diff --git a/.releaserc.yaml b/.releaserc.yaml index 7e9ed03..7438140 100644 --- a/.releaserc.yaml +++ b/.releaserc.yaml @@ -11,7 +11,7 @@ plugins: - - "@semantic-release/exec" - prepareCmd: | ./mvnw versions:set -DnewVersion=${nextRelease.version} && - sed -i "/image:.*-service:/ s|:[^:]*$|:${nextRelease.version}|" k8s/*.yaml && + sed -i "/image:.*-service:/ s|:[^:]*$|:${nextRelease.version}|" k8s/base/*.yaml && if [ "${branch.name}" = "main" ]; then ./mvnw package -B -Pnative -Dquarkus.container-image.tag=${nextRelease.version} -DskipTests fi diff --git a/account-service/src/main/docker/Dockerfile.native b/account-service/src/main/docker/Dockerfile.native index 2ef542c..8462454 100644 --- a/account-service/src/main/docker/Dockerfile.native +++ b/account-service/src/main/docker/Dockerfile.native @@ -1,5 +1,8 @@ #### # This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode. +# It uses a micro base image, tuned for Quarkus native executables. +# It reduces the size of the resulting container image. +# Check https://quarkus.io/guides/quarkus-runtime-base-image for further information about this image. # # Before building the container image run: # @@ -7,16 +10,16 @@ # # Then, build the image with: # -# docker build -f src/main/docker/Dockerfile.native -t quarkus/account-service . +# docker build -f src/main/docker/Dockerfile.native-micro -t quarkus/account-service . # # Then run the container using: # # docker run -i --rm -p 8080:8080 quarkus/account-service # -# The ` registry.access.redhat.com/ubi9/ubi-minimal:9.7` base image is based on UBI 9. -# To use UBI 8, switch to `quay.io/ubi8/ubi-minimal:8.10`. +# The `quay.io/quarkus/ubi9-quarkus-micro-image:2.0` base image is based on UBI 9. +# To use UBI 8, switch to `quay.io/quarkus/quarkus-micro-image:2.0`. ### -FROM registry.access.redhat.com/ubi9/ubi-minimal:9.7 +FROM quay.io/quarkus/ubi9-quarkus-micro-image:2.0 WORKDIR /work/ RUN chown 1001 /work \ && chmod "g+rwX" /work \ diff --git a/account-service/src/main/docker/Dockerfile.native-micro b/account-service/src/main/docker/Dockerfile.native-micro deleted file mode 100644 index 8462454..0000000 --- a/account-service/src/main/docker/Dockerfile.native-micro +++ /dev/null @@ -1,32 +0,0 @@ -#### -# This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode. -# It uses a micro base image, tuned for Quarkus native executables. -# It reduces the size of the resulting container image. -# Check https://quarkus.io/guides/quarkus-runtime-base-image for further information about this image. -# -# Before building the container image run: -# -# ./mvnw package -Dnative -# -# Then, build the image with: -# -# docker build -f src/main/docker/Dockerfile.native-micro -t quarkus/account-service . -# -# Then run the container using: -# -# docker run -i --rm -p 8080:8080 quarkus/account-service -# -# The `quay.io/quarkus/ubi9-quarkus-micro-image:2.0` base image is based on UBI 9. -# To use UBI 8, switch to `quay.io/quarkus/quarkus-micro-image:2.0`. -### -FROM quay.io/quarkus/ubi9-quarkus-micro-image:2.0 -WORKDIR /work/ -RUN chown 1001 /work \ - && chmod "g+rwX" /work \ - && chown 1001:root /work -COPY --chown=1001:root --chmod=0755 target/*-runner /work/application - -EXPOSE 8080 -USER 1001 - -ENTRYPOINT ["./application", "-Dquarkus.http.host=0.0.0.0"] diff --git a/eatery-service/src/main/docker/Dockerfile.native b/eatery-service/src/main/docker/Dockerfile.native index e0e93f0..f043cde 100644 --- a/eatery-service/src/main/docker/Dockerfile.native +++ b/eatery-service/src/main/docker/Dockerfile.native @@ -1,5 +1,8 @@ #### # This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode. +# It uses a micro base image, tuned for Quarkus native executables. +# It reduces the size of the resulting container image. +# Check https://quarkus.io/guides/quarkus-runtime-base-image for further information about this image. # # Before building the container image run: # @@ -7,16 +10,16 @@ # # Then, build the image with: # -# docker build -f src/main/docker/Dockerfile.native -t quarkus/eatery-service . +# docker build -f src/main/docker/Dockerfile.native-micro -t quarkus/eatery-service . # # Then run the container using: # # docker run -i --rm -p 8080:8080 quarkus/eatery-service # -# The ` registry.access.redhat.com/ubi9/ubi-minimal:9.7` base image is based on UBI 9. -# To use UBI 8, switch to `quay.io/ubi8/ubi-minimal:8.10`. +# The `quay.io/quarkus/ubi9-quarkus-micro-image:2.0` base image is based on UBI 9. +# To use UBI 8, switch to `quay.io/quarkus/quarkus-micro-image:2.0`. ### -FROM registry.access.redhat.com/ubi9/ubi-minimal:9.7 +FROM quay.io/quarkus/ubi9-quarkus-micro-image:2.0 WORKDIR /work/ RUN chown 1001 /work \ && chmod "g+rwX" /work \ diff --git a/eatery-service/src/main/docker/Dockerfile.native-micro b/eatery-service/src/main/docker/Dockerfile.native-micro deleted file mode 100644 index f043cde..0000000 --- a/eatery-service/src/main/docker/Dockerfile.native-micro +++ /dev/null @@ -1,32 +0,0 @@ -#### -# This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode. -# It uses a micro base image, tuned for Quarkus native executables. -# It reduces the size of the resulting container image. -# Check https://quarkus.io/guides/quarkus-runtime-base-image for further information about this image. -# -# Before building the container image run: -# -# ./mvnw package -Dnative -# -# Then, build the image with: -# -# docker build -f src/main/docker/Dockerfile.native-micro -t quarkus/eatery-service . -# -# Then run the container using: -# -# docker run -i --rm -p 8080:8080 quarkus/eatery-service -# -# The `quay.io/quarkus/ubi9-quarkus-micro-image:2.0` base image is based on UBI 9. -# To use UBI 8, switch to `quay.io/quarkus/quarkus-micro-image:2.0`. -### -FROM quay.io/quarkus/ubi9-quarkus-micro-image:2.0 -WORKDIR /work/ -RUN chown 1001 /work \ - && chmod "g+rwX" /work \ - && chown 1001:root /work -COPY --chown=1001:root --chmod=0755 target/*-runner /work/application - -EXPOSE 8080 -USER 1001 - -ENTRYPOINT ["./application", "-Dquarkus.http.host=0.0.0.0"] diff --git a/eatery-service/src/test/java/com/drinkool/services/EateryServiceTest.java b/eatery-service/src/test/java/com/drinkool/services/EateryServiceTest.java index 040ab58..8cb7d49 100644 --- a/eatery-service/src/test/java/com/drinkool/services/EateryServiceTest.java +++ b/eatery-service/src/test/java/com/drinkool/services/EateryServiceTest.java @@ -3,7 +3,6 @@ package com.drinkool.services; import static io.restassured.RestAssured.given; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.not; -import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.CoreMatchers.notNullValue; import static org.hamcrest.Matchers.hasItems; import static org.hamcrest.Matchers.hasSize; diff --git a/gateway-service/src/main/docker/Dockerfile.native b/gateway-service/src/main/docker/Dockerfile.native index 736f17f..358397c 100644 --- a/gateway-service/src/main/docker/Dockerfile.native +++ b/gateway-service/src/main/docker/Dockerfile.native @@ -1,5 +1,8 @@ #### # This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode. +# It uses a micro base image, tuned for Quarkus native executables. +# It reduces the size of the resulting container image. +# Check https://quarkus.io/guides/quarkus-runtime-base-image for further information about this image. # # Before building the container image run: # @@ -7,16 +10,16 @@ # # Then, build the image with: # -# docker build -f src/main/docker/Dockerfile.native -t quarkus/gateway-service . +# docker build -f src/main/docker/Dockerfile.native-micro -t quarkus/gateway-service . # # Then run the container using: # # docker run -i --rm -p 8080:8080 quarkus/gateway-service # -# The ` registry.access.redhat.com/ubi9/ubi-minimal:9.7` base image is based on UBI 9. -# To use UBI 8, switch to `quay.io/ubi8/ubi-minimal:8.10`. +# The `quay.io/quarkus/ubi9-quarkus-micro-image:2.0` base image is based on UBI 9. +# To use UBI 8, switch to `quay.io/quarkus/quarkus-micro-image:2.0`. ### -FROM registry.access.redhat.com/ubi9/ubi-minimal:9.7 +FROM quay.io/quarkus/ubi9-quarkus-micro-image:2.0 WORKDIR /work/ RUN chown 1001 /work \ && chmod "g+rwX" /work \ diff --git a/gateway-service/src/main/docker/Dockerfile.native-micro b/gateway-service/src/main/docker/Dockerfile.native-micro deleted file mode 100644 index 358397c..0000000 --- a/gateway-service/src/main/docker/Dockerfile.native-micro +++ /dev/null @@ -1,32 +0,0 @@ -#### -# This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode. -# It uses a micro base image, tuned for Quarkus native executables. -# It reduces the size of the resulting container image. -# Check https://quarkus.io/guides/quarkus-runtime-base-image for further information about this image. -# -# Before building the container image run: -# -# ./mvnw package -Dnative -# -# Then, build the image with: -# -# docker build -f src/main/docker/Dockerfile.native-micro -t quarkus/gateway-service . -# -# Then run the container using: -# -# docker run -i --rm -p 8080:8080 quarkus/gateway-service -# -# The `quay.io/quarkus/ubi9-quarkus-micro-image:2.0` base image is based on UBI 9. -# To use UBI 8, switch to `quay.io/quarkus/quarkus-micro-image:2.0`. -### -FROM quay.io/quarkus/ubi9-quarkus-micro-image:2.0 -WORKDIR /work/ -RUN chown 1001 /work \ - && chmod "g+rwX" /work \ - && chown 1001:root /work -COPY --chown=1001:root --chmod=0755 target/*-runner /work/application - -EXPOSE 8080 -USER 1001 - -ENTRYPOINT ["./application", "-Dquarkus.http.host=0.0.0.0"] diff --git a/gateway-service/src/main/java/com/drinkool/filters/HeaderRolesFilter.java b/gateway-service/src/main/java/com/drinkool/filters/HeaderRolesFilter.java index c28ff27..d43b7dd 100644 --- a/gateway-service/src/main/java/com/drinkool/filters/HeaderRolesFilter.java +++ b/gateway-service/src/main/java/com/drinkool/filters/HeaderRolesFilter.java @@ -83,9 +83,7 @@ public class HeaderRolesFilter extends BaseHeaderAuthentication { .addRole(role) .build(); } catch (Exception e) { - context.response() - .setStatusCode(401) - .end("InvalidToken"); + context.response().setStatusCode(401).end("InvalidToken"); } return null;