labels: location: manager clone: git: image: woodpeckerci/plugin-git settings: partial: false depth: 1 steps: # Build Step for Staging build-staging: name: build-staging image: woodpeckerci/plugin-docker-buildx environment: REGISTRY_USER: from_secret: REGISTRY_USER REGISTRY_PASSWORD: from_secret: REGISTRY_PASSWORD volumes: - /var/run/docker.sock:/var/run/docker.sock commands: - echo "Building application for staging branch" - echo "$${REGISTRY_PASSWORD}" | docker login -u "$${REGISTRY_USER}" --password-stdin git.nixc.us - docker compose -f docker-compose.staging.yml build when: branch: main event: push # Deploy New to Staging deploy-new: name: deploy-new image: woodpeckerci/plugin-docker-buildx environment: REGISTRY_USER: from_secret: REGISTRY_USER REGISTRY_PASSWORD: from_secret: REGISTRY_PASSWORD volumes: - /var/run/docker.sock:/var/run/docker.sock commands: - echo "$${REGISTRY_PASSWORD}" | docker login -u "$${REGISTRY_USER}" --password-stdin git.nixc.us - docker compose -f docker-compose.staging.yml push when: branch: main event: push # Cleanup Staging cleanup-staging: name: cleanup-staging image: woodpeckerci/plugin-docker-buildx environment: REGISTRY_USER: from_secret: REGISTRY_USER REGISTRY_PASSWORD: from_secret: REGISTRY_PASSWORD volumes: - /var/run/docker.sock:/var/run/docker.sock commands: - docker compose -f docker-compose.staging.yml down - docker compose -f docker-compose.staging.yml rm -f when: branch: main event: push # Build and Push for Production build-build-push-production: name: build-build-push-production image: woodpeckerci/plugin-docker-buildx environment: REGISTRY_USER: from_secret: REGISTRY_USER REGISTRY_PASSWORD: from_secret: REGISTRY_PASSWORD volumes: - /var/run/docker.sock:/var/run/docker.sock commands: - echo "Building application for production branch" - echo "$${REGISTRY_PASSWORD}" | docker login -u "$${REGISTRY_USER}" --password-stdin git.nixc.us - docker compose -f docker-compose.production.yml build --no-cache - docker compose -f docker-compose.production.yml push when: branch: main event: [push, cron] # Deploy to Production deploy-production: name: deploy-production image: woodpeckerci/plugin-docker-buildx environment: REGISTRY_USER: from_secret: REGISTRY_USER REGISTRY_PASSWORD: from_secret: REGISTRY_PASSWORD volumes: - /var/run/docker.sock:/var/run/docker.sock commands: - echo "$${REGISTRY_PASSWORD}" | docker login -u "$${REGISTRY_USER}" --password-stdin git.nixc.us # Uncomment this line to use docker stack deployment # - docker stack deploy --with-registry-auth -c ./stack.production.yml $${CI_REPO_NAME} when: branch: main event: [push, cron]