Hi, I am creating a pipeline, and so far I've been able to to create the image and push it to docker hub.
Now I need to log in to my EC2 instance, pull the image and run it. For that I have a shell script:
#!bin/bashsudo docker psecho 'Login in to docker'aws ecr get-login-password | - docker login --username $DOCKER_HUB_USERNAME --password $DOCKER_HUB_PASSWORD
'Fetching latest image'sudo docker pull juanibe/api:latestecho 'Stoping current container'sudo docker stop cont_docker_app_test
echo 'Removing old container'sudo docker rm cont_docker_app_test-old
echo 'Rename stoped container'
sudo docker rename cont_docker_app_test cont_docker_app_test_old
echo 'Starting new container'sudo docker run -d --name cont_docker_app_test -p 443:3333 -p 8001:8001 --link my-mongo-testing:my-mongo-testing juanibe/api:latest
And I have this yml file for bitbucket:
image: atlassian/default-image:latest
pipelines: default: - step: services: - docker script: - export IMAGE_NAME=juanibe/vinimayapi:$BITBUCKET_COMMIT - docker build -t $IMAGE_NAME . - docker login --username $DOCKER_HUB_USERNAME --password $DOCKER_HUB_PASSWORD - docker push $IMAGE_NAME
Where can I run the script??