CI/CD
image: nnsp/pipeline-runner:v0.1 # https://hub.docker.com/r/nnsp/pipeline-runner
pipelines:
branches:
dev:
- step:
name: Build and Push to ECR
script:
- IMAGE_NAME=ECR_URL
- docker build . --file Dockerfile --tag ${IMAGE_NAME}:dev
- $(aws ecr get-login --no-include-email --region ap-southeast-1) # login to ECR
- docker push ${IMAGE_NAME}:dev
services:
- docker
# caches:
# - docker
- step:
name: Deploy to EC2
script:
# /opt/atlassian/pipelines/agent/ssh/id_rsa - bitbucket default ssh-key file
- ssh $USER@$SERVER -T " cd /home/ubuntu/devops/ && bash deploy.sh" # need to add USER & SERVER variables in Repository settings
services:
- docker
# caches:
# - docker
staging:
- step:
name: Build and Push to ECR
script:
- IMAGE_NAME=ECR_URL
- docker build . --file Dockerfile --tag ${IMAGE_NAME}:staging
- $(aws ecr get-login --no-include-email --region ap-southeast-1) # login to ECR
- docker push ${IMAGE_NAME}:staging
services:
- docker
# caches:
# - docker
- step:
name: Deploy to Staging EC2
script:
# /opt/atlassian/pipelines/agent/ssh/id_rsa - bitbucket default ssh-key file
- ssh $USER@$STAGING_SERVER -T " cd /home/ubuntu/devops/ && bash deploy.sh" # need to add USER & SERVER variables in Repository settings
services:
- docker
# caches:
# - docker
Last updated