2022-08-07 14:28:37 +10:00
|
|
|
variables:
|
2022-08-07 18:04:42 +10:00
|
|
|
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA
|
2022-08-07 14:46:56 +10:00
|
|
|
IMAGE_TAG_LATEST: $CI_REGISTRY_IMAGE:latest
|
2022-08-07 15:04:07 +10:00
|
|
|
|
2022-08-07 13:37:05 +10:00
|
|
|
stages:
|
2022-08-07 16:29:55 +10:00
|
|
|
- eleventy
|
|
|
|
- docker_build
|
2022-08-07 16:49:16 +10:00
|
|
|
- docker_deploy
|
2022-08-07 14:28:37 +10:00
|
|
|
|
2022-08-07 16:29:55 +10:00
|
|
|
eleventy:
|
|
|
|
stage: eleventy
|
2022-08-07 13:37:05 +10:00
|
|
|
image: node:latest
|
|
|
|
cache:
|
|
|
|
paths:
|
|
|
|
- node_modules/
|
|
|
|
script:
|
|
|
|
- npm install
|
|
|
|
- npm run build
|
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- _site/
|
|
|
|
only:
|
2022-08-07 18:01:27 +10:00
|
|
|
- master
|
2022-08-07 14:05:13 +10:00
|
|
|
|
2022-08-07 16:29:55 +10:00
|
|
|
docker_build:
|
|
|
|
stage: docker_build
|
2023-12-31 16:01:57 +10:00
|
|
|
image:
|
|
|
|
name: gcr.io/kaniko-project/executor:debug
|
|
|
|
entrypoint: [""]
|
2022-08-07 14:05:13 +10:00
|
|
|
script:
|
2023-12-31 16:00:15 +10:00
|
|
|
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
|
2023-12-31 17:30:02 +10:00
|
|
|
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $IMAGE_TAG --destination $IMAGE_TAG_LATEST
|
2022-08-07 14:05:13 +10:00
|
|
|
only:
|
2022-08-07 18:01:27 +10:00
|
|
|
- master
|
2022-08-07 16:49:16 +10:00
|
|
|
|
2023-12-31 20:09:37 +10:00
|
|
|
docker_deploy:
|
|
|
|
stage: docker_deploy
|
|
|
|
image: kroniak/ssh-client:3.6
|
|
|
|
script:
|
|
|
|
- mkdir ~/.ssh
|
|
|
|
- echo "$SSH_KNOWN_HOSTS" >> ~/.ssh/known_hosts
|
|
|
|
- chmod 644 ~/.ssh/known_hosts
|
|
|
|
# add ssh key stored in SSH_PRIVATE_KEY variable to the agent store
|
|
|
|
- eval $(ssh-agent -s)
|
|
|
|
- ssh-add <(echo "$SSH_PRIVATE_KEY")
|
|
|
|
# log into Docker registry
|
|
|
|
- ssh administrator@docker.comprofix.xyz "docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY"
|
|
|
|
# stop container, remove image.
|
2023-12-31 21:16:56 +10:00
|
|
|
- ssh administrator@docker.comprofix.xyz "cd /opt/comprofix; docker-compose down" || true
|
2023-12-31 20:09:37 +10:00
|
|
|
# start new container
|
2023-12-31 21:20:48 +10:00
|
|
|
- scp docker-compose.yml adinistrator@docker.comprofix.xyz:/opt/comprofix
|
2023-12-31 21:16:56 +10:00
|
|
|
- ssh administrator@docker.comprofix.xyz "cd /opt/comprofix; docker-compose pull; docker-compose up -d"
|
2023-12-31 20:09:37 +10:00
|
|
|
only:
|
2023-12-31 20:12:37 +10:00
|
|
|
- master
|
2023-12-31 20:09:37 +10:00
|
|
|
|
2022-08-07 16:49:16 +10:00
|
|
|
|
|
|
|
|
2022-08-07 16:29:55 +10:00
|
|
|
|
|
|
|
|