add docker suport and pipeline

This commit is contained in:
Evandre Da Silva
2022-06-02 16:11:57 +01:00
parent cde345d696
commit c707e357a3
3 changed files with 56 additions and 94 deletions
+20 -28
View File
@@ -1,31 +1,23 @@
image: node:14.15.0
pipelines:
branches:
'{master,test}':
# - step:
# caches:
# - node
# 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 ci
# - npm install
# - ./node_modules/@angular/cli/bin/ng -v
# - npm run test
developer:
- step:
name: 'Build Images and push to Docker hub'
script:
- export BITBUCKET_COMMIT_SHORT=$(echo $BITBUCKET_COMMIT| cut -c1-7)
- export IMAGE_NAME=gabinetedigital/gdsite:$BITBUCKET_COMMIT_SHORT
- docker build -t $IMAGE_NAME -f .
- docker login --username $DOCKER_USER --password $DOCKER_PASS
- docker push $IMAGE_NAME
- step:
name: 'Deploy on server'
script:
- 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 GDOS_VERSION=${BITBUCKET_COMMIT_SHORT};cd ${COMPOSE_FOLDER} ; docker-compose up -d gdsite'
- step:
caches:
- node
script:
- apt-get update;
- npm ci
- npm install
- ./node_modules/@angular/cli/bin/ng -v
- npm run build --prod
options:
docker: true