Files
counter/.drone.yml
alexandvvvvv 78122bc996
All checks were successful
continuous-integration/drone/push Build is passing
feature/cicd (#2)
Co-authored-by: aovantsev <aovantsev@avito.ru>
Reviewed-on: #2
2025-10-03 08:32:20 +00:00

34 lines
728 B
YAML

kind: pipeline
type: docker
name: default
steps:
- name: build-and-deploy
image: docker:20.10
volumes:
- 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
volumes:
- name: dockersock
host:
path: /var/run/docker.sock
trigger:
branch:
- main
- feature/*