From 0efdc8181138352b7bf72926b44c3fd5b5927f97 Mon Sep 17 00:00:00 2001 From: Evandre Da Silva Date: Thu, 16 Jun 2022 09:45:43 +0100 Subject: [PATCH] add pipeline --- bitbucket-pipelines.yml | 44 +++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index 39b65a9b2..5e9527e91 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -1,18 +1,32 @@ -image: node:14.15.0 - +definitions: + services: + docker: + memory: 3072 pipelines: - default: - - step: + branches: + developer: + - step: + size: 2x + name: 'Build Images and push to Docker hub' caches: - - node + - docker script: - - apt-get update; apt-get install -y gettext-base; - - echo 'deb http://dl.google.com/linux/chrome/deb/ stable main' > /etc/apt/sources.list.d/chrome.list - - wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - - - set -x && apt-get update && apt-get install -y xvfb google-chrome-stable - - wget -q -O /usr/bin/xvfb-chrome https://bitbucket.org/atlassian/docker-node-chrome-firefox/raw/ff180e2f16ea8639d4ca4a3abb0017ee23c2836c/scripts/xvfb-chrome - - ln -sf /usr/bin/xvfb-chrome /usr/bin/google-chrome - - chmod 755 /usr/bin/google-chrome - - npm install - - ./node_modules/@angular/cli/bin/ng -v - - npm run test \ No newline at end of file + - export BITBUCKET_COMMIT_SHORT=$(echo $BITBUCKET_COMMIT| cut -c1-7) + - export IMAGE_NAME=gabinetedigital/gdsite:$BITBUCKET_COMMIT_SHORT + - docker build -t $IMAGE_NAME . + - docker login --username $DOCKER_USER --password $DOCKER_PASS + - docker push $IMAGE_NAME + - step: + name: 'Deploy on server' + deployment: test + script: + - echo "Starting deploy..." + - export BITBUCKET_COMMIT_SHORT=$(echo $BITBUCKET_COMMIT| cut -c1-7) + - pipe: atlassian/ssh-run:0.4.0 + variables: + SSH_USER: 'administrator' + SERVER: '41.63.166.54' + COMMAND: 'export GDSITE_VERSION=${BITBUCKET_COMMIT_SHORT};cd ${COMPOSE_FOLDER} ; docker-compose up -d gdsite' + +options: + docker: true