diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c05d89a..d1c277d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -17,6 +17,7 @@ cache: key: ${CI_COMMIT_REF_SLUG} paths: - node_modules/ + policy: pull variables: NEXT_PUBLIC_ENV: "production" @@ -65,17 +66,19 @@ dockerize: - echo "$CI_REGISTRY_PASSWORD" | docker login "$CI_REGISTRY" -u "$CI_REGISTRY_USER" --password-stdin script: - | - TAG="$CI_COMMIT_REF_NAME" - echo "Building Docker image with tag: $TAG" + RAW_TAG="$CI_COMMIT_REF_NAME" + TAG="${RAW_TAG//\//_}" # replaces "/" with "_" + echo "Sanitized tag: $TAG" docker build -t $DOCKER_IMAGE:$TAG -f Dockerfile . - if [[ "$TAG" == "dev" || "$TAG" == "production" ]]; then + if [[ "$RAW_TAG" == "dev" || "$RAW_TAG" == "production" ]]; then echo "Pushing Docker image $DOCKER_IMAGE:$TAG" docker push $DOCKER_IMAGE:$TAG else - echo "Skipping Docker push for non-dev or production branch: $TAG" + echo "Skipping Docker push for non-dev or production branch: $RAW_TAG" fi + deploy_production: stage: deploy rules: *deploy_production_rule