@@ -49,8 +49,8 @@ build_production: stage: Build script: - cp $ENV .env.production - - docker compose --env-file $ENV build - - docker compose push + - docker compose -f stack.yml --env-file $ENV build + - docker compose -f stack.yml push environment: name: production url: https://app.air.fail @@ -80,5 +80,4 @@ deploy_production: - echo "$PRODUCTION_CLUSTER_KEY" > $DOCKER_CERT_PATH/key.pem - echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" $CI_REGISTRY --password-stdin script: - - docker compose pull - - docker compose --env-file $ENV --project-name air-frontend up -d + - docker stack deploy --prune --with-registry-auth --resolve-image=always --compose-file stack.yml --detach frontend \ No newline at end of file @@ -0,0 +1,27 @@ +services: + app: + image: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA + build: + context: . + dockerfile: Dockerfile + deploy: + replicas: 1 + update_config: + parallelism: 1 + delay: 10s + order: start-first + restart_policy: + condition: on-failure + delay: 5s + max_attempts: 3 + window: 30s + placement: + constraints: + - node.role == worker + env_file: + - .env.production + +networks: + infrastructure: + name: infrastructure + external: true