From 13bdf0c79fd1fc802f06dc045ce4e042c1cd0786 Mon Sep 17 00:00:00 2001 From: Thatsaphorn Atchariyaphap Date: Thu, 29 May 2025 21:13:50 +0200 Subject: [PATCH 01/21] Update REMOTE_ENV_PATH and rules in GitLab CI config --- .gitlab-ci.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7f18eab..646ed8d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -43,7 +43,7 @@ deploy_dev: extends: .deploy-template variables: TAG: dev - REMOTE_ENV_PATH: /rheinsw/dev + REMOTE_ENV_PATH: /rheinsw rules: - if: '$CI_COMMIT_BRANCH == "dev" || $CI_COMMIT_BRANCH == "pipeline"' @@ -51,6 +51,5 @@ deploy_prod: extends: .deploy-template variables: TAG: production - REMOTE_ENV_PATH: /rheinsw/prod - rules: - - if: '$CI_COMMIT_BRANCH == "production"' \ No newline at end of file + REMOTE_ENV_PATH: /rheinsw + rules: *deploy_production_rule \ No newline at end of file -- 2.39.5 From 5e2e742151e2c7c27c5b238ec64ee2bbc045612e Mon Sep 17 00:00:00 2001 From: Thatsaphorn Atchariyaphap Date: Fri, 30 May 2025 05:33:51 +0200 Subject: [PATCH 02/21] test --- .../src/main/java/dev/rheinsw/shared/entity/BaseEntity.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/common/src/main/java/dev/rheinsw/shared/entity/BaseEntity.java b/backend/common/src/main/java/dev/rheinsw/shared/entity/BaseEntity.java index f0ee6cf..4e676b0 100644 --- a/backend/common/src/main/java/dev/rheinsw/shared/entity/BaseEntity.java +++ b/backend/common/src/main/java/dev/rheinsw/shared/entity/BaseEntity.java @@ -10,10 +10,11 @@ import lombok.Setter; import java.time.LocalDateTime; /** + * Base Entity + * * @author Thatsaphorn Atchariyaphap * @since 26.04.25 */ - @Getter @Setter @MappedSuperclass -- 2.39.5 From ca28f019685bb7e2c75e08507001b81323405fbd Mon Sep 17 00:00:00 2001 From: Thatsaphorn Atchariyaphap Date: Sun, 1 Jun 2025 11:58:12 +0200 Subject: [PATCH 03/21] Add debug log for hCaptcha site key in ContactFormSection --- frontend/components/Contact/Section/ContactFormSection.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/components/Contact/Section/ContactFormSection.tsx b/frontend/components/Contact/Section/ContactFormSection.tsx index 788eab5..ca9011d 100644 --- a/frontend/components/Contact/Section/ContactFormSection.tsx +++ b/frontend/components/Contact/Section/ContactFormSection.tsx @@ -24,6 +24,8 @@ const ContactFormSection = () => { const hCaptchaSiteKey: string = process.env.NEXT_PUBLIC_HCAPTCHA_SITE_KEY ?? "null"; + console.log(hCaptchaSiteKey); + const handleChange = (e: React.ChangeEvent) => { setForm({...form, [e.target.name]: e.target.value}); }; @@ -39,7 +41,6 @@ const ContactFormSection = () => { return; } - const res = await fetch("/api/contact", { method: "POST", headers: {"Content-Type": "application/json"}, -- 2.39.5 From 4ce1213cfd7ec5d7be30d037740da304674814f3 Mon Sep 17 00:00:00 2001 From: Thatsaphorn Atchariyaphap Date: Sun, 1 Jun 2025 12:21:29 +0200 Subject: [PATCH 04/21] Add .env file creation in frontend Dockerfile --- frontend/Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/frontend/Dockerfile b/frontend/Dockerfile index f89869b..1f9bed3 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -13,6 +13,9 @@ RUN npm ci # Copy entire project COPY . . +# Create a .env file before build +RUN echo "NEXT_PUBLIC_HCAPTCHA_SITE_KEY=$HCAPTCHA_SITE_KEY" > .env + # Build the Next.js app RUN npm run build -- 2.39.5 From edae3c8a3334950ed689d1ba474d484c2260b382 Mon Sep 17 00:00:00 2001 From: Thatsaphorn Atchariyaphap Date: Sun, 1 Jun 2025 12:27:45 +0200 Subject: [PATCH 05/21] Add HCAPTCHA_SITE_KEY as a build argument in CI Updated `.gitlab-ci.yml` to include HCAPTCHA_SITE_KEY as a build argument for frontend builds. Adjusted `.gitlab-ci-template.yml` to ensure BUILD_ARGS processes new and existing arguments correctly. This enhances customization and environment-specific builds. --- .gitlab-ci-template.yml | 2 ++ frontend/.gitlab-ci.yml | 1 + 2 files changed, 3 insertions(+) diff --git a/.gitlab-ci-template.yml b/.gitlab-ci-template.yml index 70fe6c4..701a5bd 100644 --- a/.gitlab-ci-template.yml +++ b/.gitlab-ci-template.yml @@ -26,6 +26,8 @@ if [ -n "$BUILD_FOLDER" ]; then BUILD_ARGS="$BUILD_ARGS --build-arg BUILD_FOLDER=$BUILD_FOLDER"; fi if [ -n "$IMAGE_NAME" ]; then BUILD_ARGS="$BUILD_ARGS --build-arg IMAGE_NAME=$IMAGE_NAME"; fi if [ -n "$MAIN_CLASS" ]; then BUILD_ARGS="$BUILD_ARGS --build-arg MAIN_CLASS=$MAIN_CLASS"; fi + if [ -n "$BUILD_ARGS" ]; then BUILD_ARGS="$BUILD_ARGS $BUILD_ARGS" fi + docker build $BUILD_ARGS -t $DOCKER_IMAGE:$TAG -f $DOCKERFILE_PATH . if [[ "$TAG" == "dev" || "$TAG" == "production" || "$TAG" == "pipeline" ]]; then diff --git a/frontend/.gitlab-ci.yml b/frontend/.gitlab-ci.yml index ff7825d..99b6ccb 100644 --- a/frontend/.gitlab-ci.yml +++ b/frontend/.gitlab-ci.yml @@ -19,5 +19,6 @@ docker_frontend: IMAGE_NAME: frontend WORKDIR_PATH: frontend DOCKERFILE_PATH: Dockerfile + BUILD_ARGS: "--build-arg HCAPTCHA_SITE_KEY=$HCAPTCHA_SITE_KEY" needs: - build_frontend -- 2.39.5 From 3bd4a6783f36168c0eb87db3f03be58e4050fcb8 Mon Sep 17 00:00:00 2001 From: Thatsaphorn Atchariyaphap Date: Sun, 1 Jun 2025 12:30:11 +0200 Subject: [PATCH 06/21] Add HCAPTCHA_SITE_KEY as a build argument in CI Updated `.gitlab-ci.yml` to include HCAPTCHA_SITE_KEY as a build argument for frontend builds. Adjusted `.gitlab-ci-template.yml` to ensure BUILD_ARGS processes new and existing arguments correctly. This enhances customization and environment-specific builds. --- .gitlab-ci-template.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci-template.yml b/.gitlab-ci-template.yml index 701a5bd..d2fc6c4 100644 --- a/.gitlab-ci-template.yml +++ b/.gitlab-ci-template.yml @@ -26,7 +26,7 @@ if [ -n "$BUILD_FOLDER" ]; then BUILD_ARGS="$BUILD_ARGS --build-arg BUILD_FOLDER=$BUILD_FOLDER"; fi if [ -n "$IMAGE_NAME" ]; then BUILD_ARGS="$BUILD_ARGS --build-arg IMAGE_NAME=$IMAGE_NAME"; fi if [ -n "$MAIN_CLASS" ]; then BUILD_ARGS="$BUILD_ARGS --build-arg MAIN_CLASS=$MAIN_CLASS"; fi - if [ -n "$BUILD_ARGS" ]; then BUILD_ARGS="$BUILD_ARGS $BUILD_ARGS" fi + if [ -n "$BUILD_ARGS" ]; then BUILD_ARGS="$BUILD_ARGS $BUILD_ARGS"; fi docker build $BUILD_ARGS -t $DOCKER_IMAGE:$TAG -f $DOCKERFILE_PATH . -- 2.39.5 From 61f000336b94503186d43304ac88dbab04f72457 Mon Sep 17 00:00:00 2001 From: Thatsaphorn Atchariyaphap Date: Sun, 1 Jun 2025 12:36:04 +0200 Subject: [PATCH 07/21] revert --- .gitlab-ci-template.yml | 1 - frontend/.gitlab-ci.yml | 1 - 2 files changed, 2 deletions(-) diff --git a/.gitlab-ci-template.yml b/.gitlab-ci-template.yml index d2fc6c4..d0cf24d 100644 --- a/.gitlab-ci-template.yml +++ b/.gitlab-ci-template.yml @@ -26,7 +26,6 @@ if [ -n "$BUILD_FOLDER" ]; then BUILD_ARGS="$BUILD_ARGS --build-arg BUILD_FOLDER=$BUILD_FOLDER"; fi if [ -n "$IMAGE_NAME" ]; then BUILD_ARGS="$BUILD_ARGS --build-arg IMAGE_NAME=$IMAGE_NAME"; fi if [ -n "$MAIN_CLASS" ]; then BUILD_ARGS="$BUILD_ARGS --build-arg MAIN_CLASS=$MAIN_CLASS"; fi - if [ -n "$BUILD_ARGS" ]; then BUILD_ARGS="$BUILD_ARGS $BUILD_ARGS"; fi docker build $BUILD_ARGS -t $DOCKER_IMAGE:$TAG -f $DOCKERFILE_PATH . diff --git a/frontend/.gitlab-ci.yml b/frontend/.gitlab-ci.yml index 99b6ccb..ff7825d 100644 --- a/frontend/.gitlab-ci.yml +++ b/frontend/.gitlab-ci.yml @@ -19,6 +19,5 @@ docker_frontend: IMAGE_NAME: frontend WORKDIR_PATH: frontend DOCKERFILE_PATH: Dockerfile - BUILD_ARGS: "--build-arg HCAPTCHA_SITE_KEY=$HCAPTCHA_SITE_KEY" needs: - build_frontend -- 2.39.5 From 0f096080d794c3ff9d86d8f4ecbccc9cacaa960b Mon Sep 17 00:00:00 2001 From: Thatsaphorn Atchariyaphap Date: Sun, 1 Jun 2025 12:37:46 +0200 Subject: [PATCH 08/21] Add restart policies and volume mount to Docker services --- docker-compose.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index d752fc8..97740e5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,6 +6,7 @@ services: - "8080:8080" env_file: - ./gateway.env + restart: on-failure server: image: registry.boomlab.party/rheinsw/rheinsw-mono-repo/server @@ -14,11 +15,15 @@ services: - "8081:8081" env_file: - ./server.env + restart: on-failure frontend: image: registry.boomlab.party/rheinsw/rheinsw-mono-repo/frontend container_name: frontend + volumes: + - ./frontend.env:/app/.env # Mount it as .env at runtime env_file: - ./frontend.env ports: - "5100:3000" + restart: on-failure -- 2.39.5 From 3482c1c3f2a050c7bb5882b3788219a607d8813c Mon Sep 17 00:00:00 2001 From: Thatsaphorn Atchariyaphap Date: Sun, 1 Jun 2025 12:48:07 +0200 Subject: [PATCH 09/21] Refactor environment variable handling in frontend setup --- docker-compose.yml | 4 ++-- frontend/Dockerfile | 3 --- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 97740e5..2d10d97 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -22,8 +22,8 @@ services: container_name: frontend volumes: - ./frontend.env:/app/.env # Mount it as .env at runtime - env_file: - - ./frontend.env +# env_file: +# - ./frontend.env ports: - "5100:3000" restart: on-failure diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 1f9bed3..f89869b 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -13,9 +13,6 @@ RUN npm ci # Copy entire project COPY . . -# Create a .env file before build -RUN echo "NEXT_PUBLIC_HCAPTCHA_SITE_KEY=$HCAPTCHA_SITE_KEY" > .env - # Build the Next.js app RUN npm run build -- 2.39.5 From 2a19e583c9c508c2af6737f61a5711e8adfa1fd5 Mon Sep 17 00:00:00 2001 From: Thatsaphorn Atchariyaphap Date: Sun, 1 Jun 2025 20:15:53 +0200 Subject: [PATCH 10/21] Set HCAPTCHA_SITE_KEY as a build environment variable Added NEXT_PUBLIC_HCAPTCHA_SITE_KEY to the Dockerfile to pass the hCaptcha site key as an environment variable during the build process. This ensures the key is appropriately injected into the Next.js build. --- frontend/Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/frontend/Dockerfile b/frontend/Dockerfile index f89869b..7fd3dd2 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -13,6 +13,9 @@ RUN npm ci # Copy entire project COPY . . +# Set it as an environment variable for the build process +ENV NEXT_PUBLIC_HCAPTCHA_SITE_KEY=${HCAPTCHA_SITE_KEY} + # Build the Next.js app RUN npm run build -- 2.39.5 From eebabb5e533ee2fcc6fdc044568a7273806bb64c Mon Sep 17 00:00:00 2001 From: Thatsaphorn Atchariyaphap Date: Sun, 1 Jun 2025 20:22:26 +0200 Subject: [PATCH 11/21] Add support for HCaptcha site key during frontend build --- .gitlab-ci-template.yml | 1 + frontend/.gitlab-ci.yml | 1 + frontend/Dockerfile | 1 + 3 files changed, 3 insertions(+) diff --git a/.gitlab-ci-template.yml b/.gitlab-ci-template.yml index d0cf24d..d2fc6c4 100644 --- a/.gitlab-ci-template.yml +++ b/.gitlab-ci-template.yml @@ -26,6 +26,7 @@ if [ -n "$BUILD_FOLDER" ]; then BUILD_ARGS="$BUILD_ARGS --build-arg BUILD_FOLDER=$BUILD_FOLDER"; fi if [ -n "$IMAGE_NAME" ]; then BUILD_ARGS="$BUILD_ARGS --build-arg IMAGE_NAME=$IMAGE_NAME"; fi if [ -n "$MAIN_CLASS" ]; then BUILD_ARGS="$BUILD_ARGS --build-arg MAIN_CLASS=$MAIN_CLASS"; fi + if [ -n "$BUILD_ARGS" ]; then BUILD_ARGS="$BUILD_ARGS $BUILD_ARGS"; fi docker build $BUILD_ARGS -t $DOCKER_IMAGE:$TAG -f $DOCKERFILE_PATH . diff --git a/frontend/.gitlab-ci.yml b/frontend/.gitlab-ci.yml index ff7825d..99b6ccb 100644 --- a/frontend/.gitlab-ci.yml +++ b/frontend/.gitlab-ci.yml @@ -19,5 +19,6 @@ docker_frontend: IMAGE_NAME: frontend WORKDIR_PATH: frontend DOCKERFILE_PATH: Dockerfile + BUILD_ARGS: "--build-arg HCAPTCHA_SITE_KEY=$HCAPTCHA_SITE_KEY" needs: - build_frontend diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 7fd3dd2..e9b1acb 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -14,6 +14,7 @@ RUN npm ci COPY . . # Set it as an environment variable for the build process +ARG HCAPTCHA_SITE_KEY ENV NEXT_PUBLIC_HCAPTCHA_SITE_KEY=${HCAPTCHA_SITE_KEY} # Build the Next.js app -- 2.39.5 From 21d53bc0893808beda0628edf89a19d3ef7ca22d Mon Sep 17 00:00:00 2001 From: Thatsaphorn Atchariyaphap Date: Sun, 1 Jun 2025 20:30:54 +0200 Subject: [PATCH 12/21] Set HCAPTCHA key in .env file during Docker build This change adds a step to create a `.env` file with the HCAPTCHA site key during the Docker build process. It ensures the environment variable is available for use within the container. --- frontend/Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/frontend/Dockerfile b/frontend/Dockerfile index e9b1acb..802b149 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -17,6 +17,9 @@ COPY . . ARG HCAPTCHA_SITE_KEY ENV NEXT_PUBLIC_HCAPTCHA_SITE_KEY=${HCAPTCHA_SITE_KEY} +# Create a .env file before build +RUN echo "NEXT_PUBLIC_HCAPTCHA_SITE_KEY=$HCAPTCHA_SITE_KEY" + # Build the Next.js app RUN npm run build -- 2.39.5 From 810b2871d2ed5c0a670a27118d247b0208fbfbb4 Mon Sep 17 00:00:00 2001 From: Thatsaphorn Atchariyaphap Date: Sun, 1 Jun 2025 20:36:46 +0200 Subject: [PATCH 13/21] Set HCAPTCHA key in .env file during Docker build This change adds a step to create a `.env` file with the HCAPTCHA site key during the Docker build process. It ensures the environment variable is available for use within the container. --- frontend/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 802b149..78bbdef 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -18,7 +18,7 @@ ARG HCAPTCHA_SITE_KEY ENV NEXT_PUBLIC_HCAPTCHA_SITE_KEY=${HCAPTCHA_SITE_KEY} # Create a .env file before build -RUN echo "NEXT_PUBLIC_HCAPTCHA_SITE_KEY=$HCAPTCHA_SITE_KEY" +RUN echo "NEXT_PUBLIC_HCAPTCHA_SITE_KEY=${HCAPTCHA_SITE_KEY}" # Build the Next.js app RUN npm run build -- 2.39.5 From 2123757099c4a9e5c4cd8f12ce15c66319c99f2b Mon Sep 17 00:00:00 2001 From: Thatsaphorn Atchariyaphap Date: Sun, 1 Jun 2025 20:46:17 +0200 Subject: [PATCH 14/21] `Fix environment variable handling and update start command` Simplified environment variable substitution to improve consistency during builds. Modified the start command to source variables from .env, ensuring proper runtime configuration. --- frontend/Dockerfile | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 78bbdef..7982ced 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -13,12 +13,12 @@ RUN npm ci # Copy entire project COPY . . -# Set it as an environment variable for the build process -ARG HCAPTCHA_SITE_KEY -ENV NEXT_PUBLIC_HCAPTCHA_SITE_KEY=${HCAPTCHA_SITE_KEY} - -# Create a .env file before build -RUN echo "NEXT_PUBLIC_HCAPTCHA_SITE_KEY=${HCAPTCHA_SITE_KEY}" +## Set it as an environment variable for the build process +#ARG HCAPTCHA_SITE_KEY +#ENV NEXT_PUBLIC_HCAPTCHA_SITE_KEY=$HCAPTCHA_SITE_KEY +# +## Create a .env file before build +#RUN echo "NEXT_PUBLIC_HCAPTCHA_SITE_KEY=$HCAPTCHA_SITE_KEY" # Build the Next.js app RUN npm run build @@ -35,4 +35,4 @@ COPY --from=builder /app ./ EXPOSE 3000 # Start Next.js in production mode -CMD ["npm", "run", "start"] +CMD ["/bin/sh", "-c", "set -a && [ -f .env ] && . .env && set +a && next start"] -- 2.39.5 From b74509d45dd84cd40dbb6a6ad9c43a2cf892ffe4 Mon Sep 17 00:00:00 2001 From: Thatsaphorn Atchariyaphap Date: Sun, 1 Jun 2025 20:50:09 +0200 Subject: [PATCH 15/21] Revert --- .gitlab-ci-template.yml | 3 +-- docker-compose.yml | 4 ---- frontend/.gitlab-ci.yml | 1 - frontend/Dockerfile | 9 +-------- 4 files changed, 2 insertions(+), 15 deletions(-) diff --git a/.gitlab-ci-template.yml b/.gitlab-ci-template.yml index d2fc6c4..a645d9e 100644 --- a/.gitlab-ci-template.yml +++ b/.gitlab-ci-template.yml @@ -26,8 +26,7 @@ if [ -n "$BUILD_FOLDER" ]; then BUILD_ARGS="$BUILD_ARGS --build-arg BUILD_FOLDER=$BUILD_FOLDER"; fi if [ -n "$IMAGE_NAME" ]; then BUILD_ARGS="$BUILD_ARGS --build-arg IMAGE_NAME=$IMAGE_NAME"; fi if [ -n "$MAIN_CLASS" ]; then BUILD_ARGS="$BUILD_ARGS --build-arg MAIN_CLASS=$MAIN_CLASS"; fi - if [ -n "$BUILD_ARGS" ]; then BUILD_ARGS="$BUILD_ARGS $BUILD_ARGS"; fi - + docker build $BUILD_ARGS -t $DOCKER_IMAGE:$TAG -f $DOCKERFILE_PATH . if [[ "$TAG" == "dev" || "$TAG" == "production" || "$TAG" == "pipeline" ]]; then diff --git a/docker-compose.yml b/docker-compose.yml index 2d10d97..902fcef 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -20,10 +20,6 @@ services: frontend: image: registry.boomlab.party/rheinsw/rheinsw-mono-repo/frontend container_name: frontend - volumes: - - ./frontend.env:/app/.env # Mount it as .env at runtime -# env_file: -# - ./frontend.env ports: - "5100:3000" restart: on-failure diff --git a/frontend/.gitlab-ci.yml b/frontend/.gitlab-ci.yml index 99b6ccb..ff7825d 100644 --- a/frontend/.gitlab-ci.yml +++ b/frontend/.gitlab-ci.yml @@ -19,6 +19,5 @@ docker_frontend: IMAGE_NAME: frontend WORKDIR_PATH: frontend DOCKERFILE_PATH: Dockerfile - BUILD_ARGS: "--build-arg HCAPTCHA_SITE_KEY=$HCAPTCHA_SITE_KEY" needs: - build_frontend diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 7982ced..f89869b 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -13,13 +13,6 @@ RUN npm ci # Copy entire project COPY . . -## Set it as an environment variable for the build process -#ARG HCAPTCHA_SITE_KEY -#ENV NEXT_PUBLIC_HCAPTCHA_SITE_KEY=$HCAPTCHA_SITE_KEY -# -## Create a .env file before build -#RUN echo "NEXT_PUBLIC_HCAPTCHA_SITE_KEY=$HCAPTCHA_SITE_KEY" - # Build the Next.js app RUN npm run build @@ -35,4 +28,4 @@ COPY --from=builder /app ./ EXPOSE 3000 # Start Next.js in production mode -CMD ["/bin/sh", "-c", "set -a && [ -f .env ] && . .env && set +a && next start"] +CMD ["npm", "run", "start"] -- 2.39.5 From 7649860b4356d4a5fbca8d1bd49c2af375b054b1 Mon Sep 17 00:00:00 2001 From: Thatsaphorn Atchariyaphap Date: Sun, 1 Jun 2025 20:55:43 +0200 Subject: [PATCH 16/21] Refactor Dockerfile to optimize build and align with CI artifacts --- frontend/.gitlab-ci.yml | 6 ++++++ frontend/Dockerfile | 40 +++++++++++++++++----------------------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/frontend/.gitlab-ci.yml b/frontend/.gitlab-ci.yml index ff7825d..a520bed 100644 --- a/frontend/.gitlab-ci.yml +++ b/frontend/.gitlab-ci.yml @@ -12,6 +12,12 @@ build_frontend: cd frontend npm install npx next build + artifacts: + paths: + - frontend/.next + - frontend/public + - frontend/package.json + - frontend/package-lock.json docker_frontend: extends: .docker-build-template diff --git a/frontend/Dockerfile b/frontend/Dockerfile index f89869b..c57f214 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -1,31 +1,25 @@ -# Use lightweight Node.js 20 base image -FROM node:20-alpine@sha256:9bef0ef1e268f60627da9ba7d7605e8831d5b56ad07487d24d1aa386336d1944 as builder - -# Set working directory -WORKDIR /app - -# Copy package files separately for better Docker caching -COPY package.json package-lock.json ./ - -# Install dependencies -RUN npm ci - -# Copy entire project -COPY . . - -# Build the Next.js app -RUN npm run build - -# Use a minimal base image for running the app +# Use a lightweight Node.js 20 Alpine image (digest-pinned for reproducibility) FROM node:20-alpine@sha256:9bef0ef1e268f60627da9ba7d7605e8831d5b56ad07487d24d1aa386336d1944 +# Set the working directory inside the container WORKDIR /app -# Copy built files from the builder stage -COPY --from=builder /app ./ +# Copy only the production-ready files built in CI +# These files must be passed as GitLab artifacts: +# - .next/ → built Next.js app +# - public/ → static assets +# - package.json → app manifest +# - package-lock.json → to lock dependencies for reproducibility +COPY .next .next +COPY public public +COPY package.json package.json +COPY package-lock.json package-lock.json -# Expose port +# Install only production dependencies to reduce image size +RUN npm ci --omit=dev + +# Expose the port that Next.js serves on (default is 3000) EXPOSE 3000 -# Start Next.js in production mode +# Start the Next.js app in production mode CMD ["npm", "run", "start"] -- 2.39.5 From 44e4a0f998c966b999731a3bc914fa761112633d Mon Sep 17 00:00:00 2001 From: Thatsaphorn Atchariyaphap Date: Sun, 1 Jun 2025 21:00:29 +0200 Subject: [PATCH 17/21] Add hCaptcha site key to frontend CI environment --- frontend/.gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/.gitlab-ci.yml b/frontend/.gitlab-ci.yml index a520bed..6cfda49 100644 --- a/frontend/.gitlab-ci.yml +++ b/frontend/.gitlab-ci.yml @@ -10,6 +10,7 @@ build_frontend: script: - | cd frontend + echo "NEXT_PUBLIC_HCAPTCHA_SITE_KEY=$HCAPTCHA_SITE_KEY" > .env npm install npx next build artifacts: -- 2.39.5 From 85fcff979321647b0772b2e15a039d93114bbe4e Mon Sep 17 00:00:00 2001 From: Thatsaphorn Atchariyaphap Date: Sun, 1 Jun 2025 21:12:15 +0200 Subject: [PATCH 18/21] Disable hCaptcha integration in ContactFormSection --- .../Contact/Section/ContactFormSection.tsx | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/frontend/components/Contact/Section/ContactFormSection.tsx b/frontend/components/Contact/Section/ContactFormSection.tsx index ca9011d..da100e1 100644 --- a/frontend/components/Contact/Section/ContactFormSection.tsx +++ b/frontend/components/Contact/Section/ContactFormSection.tsx @@ -22,9 +22,9 @@ const ContactFormSection = () => { const [loading, setLoading] = useState(false); const [error, setError] = useState(""); - const hCaptchaSiteKey: string = process.env.NEXT_PUBLIC_HCAPTCHA_SITE_KEY ?? "null"; - - console.log(hCaptchaSiteKey); + // const hCaptchaSiteKey: string = process.env.NEXT_PUBLIC_HCAPTCHA_SITE_KEY ?? "null"; + // + // console.log(hCaptchaSiteKey); const handleChange = (e: React.ChangeEvent) => { setForm({...form, [e.target.name]: e.target.value}); @@ -179,15 +179,15 @@ const ContactFormSection = () => { /> - - - + {/**/} + {/* */} + {/**/} {error && (
-- 2.39.5 From e603658fbeeced34347c30c2d28656d892740a25 Mon Sep 17 00:00:00 2001 From: Thatsaphorn Atchariyaphap Date: Mon, 2 Jun 2025 16:54:50 +0200 Subject: [PATCH 19/21] Disable hCaptcha integration in ContactFormSection --- backend/package-lock.json | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 backend/package-lock.json diff --git a/backend/package-lock.json b/backend/package-lock.json new file mode 100644 index 0000000..dfb18f1 --- /dev/null +++ b/backend/package-lock.json @@ -0,0 +1,6 @@ +{ + "name": "backend", + "lockfileVersion": 3, + "requires": true, + "packages": {} +} -- 2.39.5 From 1648e376bf35a6a9a43900a4e0951a6706502c6b Mon Sep 17 00:00:00 2001 From: Thatsaphorn Atchariyaphap Date: Mon, 2 Jun 2025 16:55:08 +0200 Subject: [PATCH 20/21] Disable hCaptcha integration in ContactFormSection --- .../Contact/Section/ContactFormSection.tsx | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/frontend/components/Contact/Section/ContactFormSection.tsx b/frontend/components/Contact/Section/ContactFormSection.tsx index da100e1..927d173 100644 --- a/frontend/components/Contact/Section/ContactFormSection.tsx +++ b/frontend/components/Contact/Section/ContactFormSection.tsx @@ -35,11 +35,11 @@ const ContactFormSection = () => { setLoading(true); setError(""); - if (!captchaToken) { - setError("Bitte löse das CAPTCHA, um fortzufahren."); - setLoading(false); - return; - } + // if (!captchaToken) { + // setError("Bitte löse das CAPTCHA, um fortzufahren."); + // setLoading(false); + // return; + // } const res = await fetch("/api/contact", { method: "POST", @@ -189,11 +189,11 @@ const ContactFormSection = () => { {/* */} {/**/} - {error && ( -
- ❌ {error} -
- )} + {/*{error && (*/} + {/*
*/} + {/* ❌ {error}*/} + {/*
*/} + {/*)}*/} Date: Sat, 28 Jun 2025 12:01:43 +0000 Subject: [PATCH 21/21] Refactor website to use shadcn components --- frontend/app/(root)/Home.tsx | 45 + frontend/app/(root)/layout.tsx | 37 - frontend/app/(root)/page.tsx | 10 +- .../(root)/sections}/About.tsx | 54 +- frontend/app/(root)/sections/Faq.tsx | 109 ++ frontend/app/(root)/sections/Hero.tsx | 76 + frontend/app/(root)/sections/HomeServices.tsx | 115 ++ .../app/(root)/sections/ProcessSection.tsx | 88 ++ .../app/(root)/sections/ReferralSection.tsx | 60 + frontend/app/(root)/sections/TechStack.tsx | 87 ++ frontend/app/(root)/sections/WhyUs.tsx | 69 + .../about}/Section/TeamSection.tsx | 52 +- frontend/app/about/layout.tsx | 37 - frontend/app/about/page.tsx | 12 - frontend/app/contact/layout.tsx | 37 - frontend/app/contact/page.tsx | 7 + frontend/app/globals.css | 68 + frontend/app/layout.tsx | 58 + frontend/app/legal/imprint/ImprintComp.tsx | 117 ++ frontend/app/legal/imprint/page.tsx | 11 +- frontend/app/legal/layout.tsx | 38 - frontend/app/legal/page.tsx | 64 +- .../legal/privacy}/PrivacyComp.tsx | 39 +- frontend/app/legal/privacy/page.tsx | 9 +- frontend/app/legal/revocation/page.tsx | 12 - .../app/legal/terms-of-use/TermsOfUseComp.tsx | 98 ++ frontend/app/legal/terms-of-use/page.tsx | 9 +- frontend/app/services/layout.tsx | 37 - frontend/app/services/page.tsx | 12 - frontend/components.json | 21 + frontend/components/About/AboutContent.tsx | 47 - .../components/About/Section/AboutHero.tsx | 19 - .../components/About/Section/AboutIntro.tsx | 68 - .../components/About/Section/AboutProcess.tsx | 158 -- .../About/Section/AboutTimeline.tsx | 94 -- frontend/components/CTA/DualCTA.tsx | 66 + frontend/components/Contact/Contact.tsx | 53 +- .../Contact/Section/ContactFormSection.tsx | 191 +-- .../Contact/Section/ContactHero.tsx | 19 - .../components/Cookie/CookieConsentBanner.tsx | 128 ++ frontend/components/Footer/Footer.tsx | 142 +- frontend/components/Helper/SmallHero.tsx | 53 +- frontend/components/Helper/ThemeColors.ts | 34 - frontend/components/Home/Home.tsx | 45 - .../components/Home/Sections/ContactCTA.tsx | 62 - frontend/components/Home/Sections/Hero.tsx | 100 -- .../components/Home/Sections/HomeServices.tsx | 105 -- .../components/Home/Sections/TechStack.tsx | 139 -- .../components/Legal/Imprint/ImprintComp.tsx | 131 -- frontend/components/Legal/RevocationComp.tsx | 98 -- frontend/components/Legal/TermsOfUseComp.tsx | 99 -- frontend/components/Navbar/DesktopNav.tsx | 110 -- frontend/components/Navbar/MobileNav.tsx | 62 - frontend/components/Navbar/Nav.tsx | 24 - frontend/components/Navbar/Navbar.tsx | 102 ++ frontend/components/PulsatingButton.tsx | 136 ++ .../Services/Section/OverviewTabs.tsx | 81 - .../Services/Section/ServiceHero.tsx | 19 - .../Services/Section/overview/BugFixing.tsx | 59 - .../Services/Section/overview/Consulting.tsx | 60 - .../Services/Section/overview/Development.tsx | 210 --- .../Section/overview/ManagedServices.tsx | 62 - frontend/components/Services/Services.tsx | 38 - .../components/provider/ThemeProvider.tsx | 50 - frontend/components/theme-provider.tsx | 11 + frontend/components/theme-toggle.tsx | 26 + frontend/components/ui/accordion.tsx | 57 + frontend/components/ui/button.tsx | 57 + frontend/components/ui/card.tsx | 76 + frontend/components/ui/dropdown-menu.tsx | 201 +++ frontend/components/ui/navigation-menu.tsx | 128 ++ frontend/components/ui/sheet.tsx | 140 ++ frontend/constant/TechStack.ts | 49 + frontend/lib/utils.ts | 6 + frontend/package-lock.json | 1370 +++++++++++++++-- frontend/package.json | 20 +- frontend/tailwind.config.ts | 77 +- frontend/utils/useThemeColors.ts | 10 - 78 files changed, 3858 insertions(+), 2722 deletions(-) create mode 100644 frontend/app/(root)/Home.tsx delete mode 100644 frontend/app/(root)/layout.tsx rename frontend/{components/Home/Sections => app/(root)/sections}/About.tsx (59%) create mode 100644 frontend/app/(root)/sections/Faq.tsx create mode 100644 frontend/app/(root)/sections/Hero.tsx create mode 100644 frontend/app/(root)/sections/HomeServices.tsx create mode 100644 frontend/app/(root)/sections/ProcessSection.tsx create mode 100644 frontend/app/(root)/sections/ReferralSection.tsx create mode 100644 frontend/app/(root)/sections/TechStack.tsx create mode 100644 frontend/app/(root)/sections/WhyUs.tsx rename frontend/{components/About => app/about}/Section/TeamSection.tsx (62%) delete mode 100644 frontend/app/about/layout.tsx delete mode 100644 frontend/app/about/page.tsx delete mode 100644 frontend/app/contact/layout.tsx create mode 100644 frontend/app/layout.tsx create mode 100644 frontend/app/legal/imprint/ImprintComp.tsx delete mode 100644 frontend/app/legal/layout.tsx rename frontend/{components/Legal/Privacy => app/legal/privacy}/PrivacyComp.tsx (77%) delete mode 100644 frontend/app/legal/revocation/page.tsx create mode 100644 frontend/app/legal/terms-of-use/TermsOfUseComp.tsx delete mode 100644 frontend/app/services/layout.tsx delete mode 100644 frontend/app/services/page.tsx create mode 100644 frontend/components.json delete mode 100644 frontend/components/About/AboutContent.tsx delete mode 100644 frontend/components/About/Section/AboutHero.tsx delete mode 100644 frontend/components/About/Section/AboutIntro.tsx delete mode 100644 frontend/components/About/Section/AboutProcess.tsx delete mode 100644 frontend/components/About/Section/AboutTimeline.tsx create mode 100644 frontend/components/CTA/DualCTA.tsx delete mode 100644 frontend/components/Contact/Section/ContactHero.tsx create mode 100644 frontend/components/Cookie/CookieConsentBanner.tsx delete mode 100644 frontend/components/Helper/ThemeColors.ts delete mode 100644 frontend/components/Home/Home.tsx delete mode 100644 frontend/components/Home/Sections/ContactCTA.tsx delete mode 100644 frontend/components/Home/Sections/Hero.tsx delete mode 100644 frontend/components/Home/Sections/HomeServices.tsx delete mode 100644 frontend/components/Home/Sections/TechStack.tsx delete mode 100644 frontend/components/Legal/Imprint/ImprintComp.tsx delete mode 100644 frontend/components/Legal/RevocationComp.tsx delete mode 100644 frontend/components/Legal/TermsOfUseComp.tsx delete mode 100644 frontend/components/Navbar/DesktopNav.tsx delete mode 100644 frontend/components/Navbar/MobileNav.tsx delete mode 100644 frontend/components/Navbar/Nav.tsx create mode 100644 frontend/components/Navbar/Navbar.tsx create mode 100644 frontend/components/PulsatingButton.tsx delete mode 100644 frontend/components/Services/Section/OverviewTabs.tsx delete mode 100644 frontend/components/Services/Section/ServiceHero.tsx delete mode 100644 frontend/components/Services/Section/overview/BugFixing.tsx delete mode 100644 frontend/components/Services/Section/overview/Consulting.tsx delete mode 100644 frontend/components/Services/Section/overview/Development.tsx delete mode 100644 frontend/components/Services/Section/overview/ManagedServices.tsx delete mode 100644 frontend/components/Services/Services.tsx delete mode 100644 frontend/components/provider/ThemeProvider.tsx create mode 100644 frontend/components/theme-provider.tsx create mode 100644 frontend/components/theme-toggle.tsx create mode 100644 frontend/components/ui/accordion.tsx create mode 100644 frontend/components/ui/button.tsx create mode 100644 frontend/components/ui/card.tsx create mode 100644 frontend/components/ui/dropdown-menu.tsx create mode 100644 frontend/components/ui/navigation-menu.tsx create mode 100644 frontend/components/ui/sheet.tsx create mode 100644 frontend/constant/TechStack.ts create mode 100644 frontend/lib/utils.ts delete mode 100644 frontend/utils/useThemeColors.ts diff --git a/frontend/app/(root)/Home.tsx b/frontend/app/(root)/Home.tsx new file mode 100644 index 0000000..3bb024a --- /dev/null +++ b/frontend/app/(root)/Home.tsx @@ -0,0 +1,45 @@ +'use client'; + +import React, {useEffect} from "react"; +import HomeServices from "@/app/(root)/sections/HomeServices"; +import {motion} from "framer-motion"; +import Hero from "@/app/(root)/sections/Hero"; +import About from "@/app/(root)/sections/About"; +import ProcessSection from "@/app/(root)/sections/ProcessSection"; +import WhyUs from "@/app/(root)/sections/WhyUs"; +import Faq from "@/app/(root)/sections/Faq"; +import ReferralSection from "@/app/(root)/sections/ReferralSection"; + +const Home = () => { + useEffect(() => { + const scrollToId = localStorage.getItem('scrollToId') + if (scrollToId) { + localStorage.removeItem('scrollToId') + const el = document.getElementById(scrollToId) + if (el) { + setTimeout(() => { + el.scrollIntoView({behavior: 'smooth', block: 'start'}) + }, 200) + } + } + }, []) + + return ( + + + + + + + + + + ); +}; + +export default Home; diff --git a/frontend/app/(root)/layout.tsx b/frontend/app/(root)/layout.tsx deleted file mode 100644 index 518d45e..0000000 --- a/frontend/app/(root)/layout.tsx +++ /dev/null @@ -1,37 +0,0 @@ -import type {Metadata} from "next"; -import "../globals.css"; - -import Nav from "@/components/Navbar/Nav"; -import Footer from "@/components/Footer/Footer"; -import {ThemeProvider} from "@/components/provider/ThemeProvider"; -import React from "react"; -import {cookies} from "next/headers"; -import {themeColors} from "@/components/Helper/ThemeColors"; - -export const metadata: Metadata = { - title: "Rhein Software", - description: "Rhein Software Development", -}; - -export default async function RootLayout({ - children, - }: Readonly<{ - children: React.ReactNode; -}>) { - const cookieStore = await cookies(); - const theme = cookieStore.get("theme")?.value === "dark" ? "dark" : "light"; - const bgColor = themeColors[theme].primaryBg; - - return ( - - - - -