feature/cicd (#2)
All checks were successful
continuous-integration/drone/push Build is passing

Co-authored-by: aovantsev <aovantsev@avito.ru>
Reviewed-on: #2
This commit is contained in:
2025-10-03 08:32:20 +00:00
parent 0dcb5d9b87
commit 78122bc996
4 changed files with 116 additions and 39 deletions

View File

@@ -4,38 +4,30 @@ name: default
steps:
- name: build-and-deploy
image: docker:20.10.16
environment:
DOCKER_HOST: unix:///var/run/docker.sock
image: docker:20.10
volumes:
- name: docker-sock
- name: dockersock
path: /var/run/docker.sock
commands:
# Build the Docker image
- docker build -t localhost:5000/counter:latest .
# Push to local registry
- docker push localhost:5000/counter:latest
# Stop and remove existing container if it exists
- docker stop counter-app || true
- docker rm counter-app || true
# Run the new container
- docker run -d --name counter-app -p 8080:8080 localhost:5000/counter:latest
# Wait a moment for the container to start
- sleep 5
# Test the API
- curl -f http://localhost:8080/ || exit 1
volumes:
- name: docker-sock
- name: dockersock
host:
path: /var/run/docker.sock
trigger:
branch:
- main
- master
- feature/*