Commit c5b5a896 authored by Gadhave's avatar Gadhave
Browse files

Update .gitlab-ci.yml file

parent 003168d4
Pipeline #12108 canceled with stages
in 1 minute and 52 seconds
...@@ -2,7 +2,7 @@ stages: ...@@ -2,7 +2,7 @@ stages:
- lint - lint
- test - test
- diag - diag
# - build - build
- deploy - deploy
variables: variables:
...@@ -64,6 +64,24 @@ diag: ...@@ -64,6 +64,24 @@ diag:
- docker version || true - docker version || true
- docker info || true - docker info || true
build:
stage: build
image: docker:24.0.9
extends: .build_template
before_script:
- echo "Building Docker image for commit:" ${CI_COMMIT_SHORT_SHA}
- echo "Logging in to Docker registry..."
- echo "Docker Registry :" ${DOCKER_REGISTRY}
- echo "Docker Username :" ${DOCKER_USERNAME}
- echo "Docker Passowrd :" ${DOCKER_PASSWORD}
script:
- echo "Building image..."
- cd Desktop/Telegram_Bot
- docker build -t $DOCKERHUB_REPO:$CI_COMMIT_SHORT_SHA .
after_script:
- echo "Docker image pushed successfully!"
deploy: deploy:
stage: deploy stage: deploy
image: docker:24.0.9 image: docker:24.0.9
...@@ -73,4 +91,8 @@ deploy: ...@@ -73,4 +91,8 @@ deploy:
- echo "Logged into dockerhub succesfully" - echo "Logged into dockerhub succesfully"
- docker push $DOCKERHUB_REPO:$PREVIOUS_BUILD_TAG - docker push $DOCKERHUB_REPO:$PREVIOUS_BUILD_TAG
- echo "Pushed the docker image to dockerhub succesfully" - echo "Pushed the docker image to dockerhub succesfully"
- if [ "$CI_COMMIT_BRANCH" = "$CI_DEFAULT_BRANCH" ]; then
docker tag $DOCKERHUB_REPO:$CI_COMMIT_SHORT_SHA $DOCKERHUB_REPO:latest;
docker push $DOCKERHUB_REPO:latest;
fi
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment