Last active
February 8, 2025 15:43
-
-
Save vladmeh/91d81869ee195ce293d3efdd8a40f5db to your computer and use it in GitHub Desktop.
Revisions
-
vladmeh revised this gist
Feb 8, 2025 . 1 changed file with 9 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,4 +10,12 @@ docker tag ${IMAGE}:${GIT_VERSION} ${IMAGE}:latest # Вход в Docker Hub и выгрузка образа echo "${DOCKER_PASSWORD}" | docker login -u "${DOCKER_USERNAME}" --password-stdin docker push ${IMAGE}:${GIT_VERSION} # Найти ID работающего контейнера CONTAINER_ID=$(docker ps | grep takenote | cut -d" " -f1) # Остановить старый контейнер, запустить новый, очистить систему docker stop ${CONTAINER_ID} docker run --restart unless-stopped -d -p 80:5000 ${IMAGE}:${GIT_VERSION} docker system prune -a -f -
vladmeh created this gist
Feb 8, 2025 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,13 @@ #!/bin/sh set -e # Остановить скрипт при наличии ошибок IMAGE="<username>/<repository>" # Образ Docker GIT_VERSION=$(git describe --always --abbrev --tags --long) # Git-хэш и теги # Сборка и тегирование образа docker build -t ${IMAGE}:${GIT_VERSION} . docker tag ${IMAGE}:${GIT_VERSION} ${IMAGE}:latest # Вход в Docker Hub и выгрузка образа echo "${DOCKER_PASSWORD}" | docker login -u "${DOCKER_USERNAME}" --password-stdin docker push ${IMAGE}:${GIT_VERSION}