feature/cicd #2

Merged
alexandvvvvv merged 8 commits from feature/cicd into main 2025-10-03 08:32:21 +00:00
Showing only changes of commit 20d64a6472 - Show all commits

View File

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