Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- stages:
- - build
- - push
- - deploy
- variables:
- DOCKER_IMAGE: "username/product-service"
- DOCKER_TAG: "latest"
- build:
- stage: build
- script:
- - docker build -t $DOCKER_IMAGE:$DOCKER_TAG .
- only:
- - main
- push:
- stage: push
- script:
- - echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" --password-stdin
- - docker push $DOCKER_IMAGE:$DOCKER_TAG
- only:
- - main
- deploy:
- stage: deploy
- script:
- - docker pull $DOCKER_IMAGE:$DOCKER_TAG
- - docker stop product-service || true
- - docker rm product-service || true
- - docker run -d --name product-service -p 80:80 $DOCKER_IMAGE:$DOCKER_TAG
- only:
- - main
Advertisement
Add Comment
Please, Sign In to add comment