diff --git a/.gitlab-ci-template.yml b/.gitlab-ci-template.yml index a645d9e..89722a3 100644 --- a/.gitlab-ci-template.yml +++ b/.gitlab-ci-template.yml @@ -18,27 +18,52 @@ script: - !reference [ .image-tag-template, script ] - | - echo "Building Docker image for $IMAGE_NAME in $WORKDIR_PATH" - cd $WORKDIR_PATH + echo "Building Docker image for service: $IMAGE_NAME" + echo "Switching to workdir: $WORKDIR_PATH" + cd "$WORKDIR_PATH" + + echo "Image Tag: $TAG" + echo "Docker Image: $DOCKER_IMAGE:$TAG" + echo "Dockerfile: $DOCKERFILE_PATH" BUILD_ARGS="--build-arg IMAGE_TAG=$TAG" - if [ -n "$COMMON_IMAGE" ]; then BUILD_ARGS="$BUILD_ARGS --build-arg COMMON_IMAGE=$COMMON_IMAGE:$TAG"; fi - 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 - - docker build $BUILD_ARGS -t $DOCKER_IMAGE:$TAG -f $DOCKERFILE_PATH . + + if [ -n "$COMMON_IMAGE" ]; then + COMMON_IMAGE="${COMMON_IMAGE%:}" # Strip trailing colon if any + echo "Using COMMON_IMAGE: $COMMON_IMAGE:$TAG" + BUILD_ARGS="$BUILD_ARGS --build-arg COMMON_IMAGE=$COMMON_IMAGE:$TAG" + fi + + if [ -n "$BUILD_FOLDER" ]; then + echo "BUILD_FOLDER: $BUILD_FOLDER" + BUILD_ARGS="$BUILD_ARGS --build-arg BUILD_FOLDER=$BUILD_FOLDER" + fi + + if [ -n "$IMAGE_NAME" ]; then + echo "IMAGE_NAME: $IMAGE_NAME" + BUILD_ARGS="$BUILD_ARGS --build-arg IMAGE_NAME=$IMAGE_NAME" + fi + + if [ -n "$MAIN_CLASS" ]; then + echo "MAIN_CLASS: $MAIN_CLASS" + BUILD_ARGS="$BUILD_ARGS --build-arg MAIN_CLASS=$MAIN_CLASS" + fi + + echo "Final docker build command:" + echo "docker build $BUILD_ARGS -t $DOCKER_IMAGE:$TAG -f $DOCKERFILE_PATH ." + + docker build $BUILD_ARGS -t $DOCKER_IMAGE:$TAG -f "$DOCKERFILE_PATH" . if [[ "$TAG" == "dev" || "$TAG" == "production" || "$TAG" == "pipeline" ]]; then - echo "Pushing Docker image $DOCKER_IMAGE:$TAG" + echo "Pushing Docker image: $DOCKER_IMAGE:$TAG" docker push $DOCKER_IMAGE:$TAG - # After pushing the image - DIGEST=$(docker inspect --format='{{index .RepoDigests 0}}' $DOCKER_IMAGE:$TAG | cut -d '@' -f2) + echo "Inspecting image digest..." + DIGEST=$(docker inspect --format='{{index .RepoDigests 0}}' "$DOCKER_IMAGE:$TAG" | cut -d '@' -f2) echo "$DIGEST" > "$CI_PROJECT_DIR/digest-${IMAGE_NAME}.txt" echo "Digest for $IMAGE_NAME: $DIGEST" else - echo "Skipping push for non-dev/non-production branch: $TAG" + echo "Skipping push (branch/tag '$TAG' is not dev/production/pipeline)" fi artifacts: paths: diff --git a/frontend/components/Contact/Section/ContactFormSection.tsx b/frontend/components/Contact/Section/ContactFormSection.tsx index c2902fe..0d2f299 100644 --- a/frontend/components/Contact/Section/ContactFormSection.tsx +++ b/frontend/components/Contact/Section/ContactFormSection.tsx @@ -2,7 +2,8 @@ import React, {useState} from 'react' import {motion} from 'framer-motion' -// import HCaptcha from '@hcaptcha/react-hcaptcha' +import {Button} from '@/components/ui/button' +import ReCAPTCHA from 'react-google-recaptcha' const ContactFormSection = () => { const [form, setForm] = useState({ @@ -30,6 +31,12 @@ const ContactFormSection = () => { setLoading(true) setError('') + if (!captchaToken) { + setError('Bitte bestätige, dass du kein Roboter bist.') + setLoading(false) + return + } + const res = await fetch('/api/contact', { method: 'POST', headers: {'Content-Type': 'application/json'}, @@ -38,10 +45,21 @@ const ContactFormSection = () => { if (res.ok) { setSubmitted(true) - setForm({name: '', email: '', company: '', phone: '', website: '', message: ''}) + setForm({ + name: '', + email: '', + company: '', + phone: '', + website: '', + message: '', + }) + setCaptchaToken('') } else { const resJson = await res.json() - setError(resJson?.error || 'Ein Fehler ist aufgetreten. Bitte versuche es später erneut.') + setError( + resJson?.error || + 'Ein Fehler ist aufgetreten. Bitte versuche es später erneut.' + ) } setLoading(false) @@ -142,7 +160,9 @@ const ContactFormSection = () => { viewport={{once: true}} transition={{duration: 0.5, delay: 0.6}} > - +