Add deployment automation
* Introduce `docker-compose.yml` for containerized service orchestration. * Update `.gitlab-ci.yml` with new deployment stages and sync mechanisms, including production and dev environments.
This commit is contained in:
@@ -2,11 +2,14 @@ image: docker:20.10@sha256:2967f0819c84dd589ed0a023b9d25dcfe7a3c123d5bf784ffbb77
|
||||
|
||||
include:
|
||||
- local: '.gitlab-ci-template.yml'
|
||||
- local: 'main-website/.gitlab-ci.yml'
|
||||
- local: 'lawfirm-demos/.gitlab-ci.yml'
|
||||
|
||||
stages:
|
||||
- build
|
||||
- dockerize
|
||||
- deploy
|
||||
- sync
|
||||
|
||||
variables:
|
||||
CI_REGISTRY_IMAGE: $CI_REGISTRY/$CI_PROJECT_PATH
|
||||
@@ -20,21 +23,37 @@ cache:
|
||||
- node_modules/
|
||||
- .next/cache/
|
||||
|
||||
# Main Website - Build
|
||||
build_main:
|
||||
stage: build
|
||||
extends: .build-next-template
|
||||
variables:
|
||||
WORKDIR_PATH: main-website
|
||||
.deploy_production_rule: &deploy_production_rule
|
||||
- if: $CI_COMMIT_BRANCH == "production"
|
||||
when: manual
|
||||
allow_failure: true
|
||||
|
||||
# Main Website - Dockerize
|
||||
docker_main:
|
||||
stage: dockerize
|
||||
extends: .docker-build-template
|
||||
sync_dev_branch:
|
||||
stage: sync
|
||||
image: node:22@sha256:f6b9c31ace05502dd98ef777aaa20464362435dcc5e312b0e213121dcf7d8b95
|
||||
rules:
|
||||
- if: '$CI_COMMIT_BRANCH == "production"'
|
||||
before_script:
|
||||
- git config --global user.email "gitlab-ci@rhein-software.dev"
|
||||
- git config --global user.name "GitLab CI"
|
||||
script:
|
||||
- git remote set-url origin "https://oauth2:${CI_JOB_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git"
|
||||
- git checkout dev
|
||||
- git pull origin dev
|
||||
- git merge --no-ff origin/production
|
||||
- git push origin dev
|
||||
|
||||
deploy_dev:
|
||||
extends: .deploy-template
|
||||
variables:
|
||||
IMAGE_NAME: main-website
|
||||
WORKDIR_PATH: main-website
|
||||
DOCKERFILE_PATH: Dockerfile
|
||||
needs:
|
||||
- job: build_main
|
||||
artifacts: true
|
||||
TAG: dev
|
||||
REMOTE_ENV_PATH: /opt/rheinsw-demo
|
||||
rules:
|
||||
- if: '$CI_COMMIT_BRANCH == "dev" || $CI_COMMIT_BRANCH == "pipeline"'
|
||||
|
||||
deploy_prod:
|
||||
extends: .deploy-template
|
||||
variables:
|
||||
TAG: production
|
||||
REMOTE_ENV_PATH: /opt/rheinsw-demo
|
||||
rules: *deploy_production_rule
|
||||
Reference in New Issue
Block a user