Loading .gitlab-ci.yml +21 −0 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ stages: - publish - deploy publish: stage: publish Loading Loading @@ -33,3 +34,23 @@ publish: - echo "Publish Docker image..." - docker push $DOCKER_IMAGE_NAME - echo "image successfully published." deploy-dev: stage: deploy image: ubuntu:24.04 before_script: - apt-get -yq update - apt-get -yqq install ssh - install -m 600 -D /dev/null ~/.ssh/id_rsa - echo "$SSH_KEY" | base64 -d > ~/.ssh/id_rsa - cat ~/.ssh/id_rsa - ssh-keyscan -p $SSH_PORT -H $SSH_HOST > ~/.ssh/known_hosts - cat ~/.ssh/known_hosts script: - ssh $SSH_USER@$SSH_HOST -p $SSH_PORT "docker service update --force --image $DOCKER_IMAGE_NAME stack_wwwdemo_www" after_script: - rm -rf ~/.ssh rules: - if: $CI_COMMIT_BRANCH == "main" environment: Development Loading
.gitlab-ci.yml +21 −0 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ stages: - publish - deploy publish: stage: publish Loading Loading @@ -33,3 +34,23 @@ publish: - echo "Publish Docker image..." - docker push $DOCKER_IMAGE_NAME - echo "image successfully published." deploy-dev: stage: deploy image: ubuntu:24.04 before_script: - apt-get -yq update - apt-get -yqq install ssh - install -m 600 -D /dev/null ~/.ssh/id_rsa - echo "$SSH_KEY" | base64 -d > ~/.ssh/id_rsa - cat ~/.ssh/id_rsa - ssh-keyscan -p $SSH_PORT -H $SSH_HOST > ~/.ssh/known_hosts - cat ~/.ssh/known_hosts script: - ssh $SSH_USER@$SSH_HOST -p $SSH_PORT "docker service update --force --image $DOCKER_IMAGE_NAME stack_wwwdemo_www" after_script: - rm -rf ~/.ssh rules: - if: $CI_COMMIT_BRANCH == "main" environment: Development