Files
counter/.drone.yml
aovantsev 2299803050
Some checks failed
continuous-integration/drone/push Build is failing
try fix
2025-10-08 21:06:58 +03:00

41 lines
1.1 KiB
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 registry:5000/counter:latest .
# Push to local registry
- docker push registry: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 with environment variables
- docker run -d --name counter-app -e ENVIRONMENT=production -e JWT_SECRET=your-super-secure-production-secret -e DATABASE_URL=postgres://postgres:password@postgres:5432/counter_db?sslmode=disable -e GIN_MODE=release -e LOG_LEVEL=warn -p 8080:8080 --network infra_backend_nw registry:5000/counter:latest
volumes:
- name: dockersock
host:
path: /var/run/docker.sock
trigger:
branch:
- main
- feature/*
event:
- push
exclude:
event:
- pull_request
- pull_request_closed
- pull_request_synchronize