diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..0c2e18c --- /dev/null +++ b/.drone.yml @@ -0,0 +1,46 @@ +kind: pipeline +type: docker +name: default + +steps: + - name: build + image: docker:27-cli + volumes: + - name: dockersock + path: /var/run/docker.sock + environment: + REGISTRY_USER: + from_secret: REGISTRY_USER + REGISTRY_PASS: + from_secret: REGISTRY_PASS + commands: + - echo "$REGISTRY_PASS" | docker login registry.infra.mintel.me -u "$REGISTRY_USER" --password-stdin + - docker build -t registry.infra.mintel.me/mintel/mb-grid-solutions:latest . + - docker push registry.infra.mintel.me/mintel/mb-grid-solutions:latest + when: + branch: + - main + event: + - push + + - name: deploy + image: alpine + environment: + ALPHA_SSH_KEY: + from_secret: ALPHA_SSH_KEY + commands: + - apk add --no-cache openssh + - mkdir -p ~/.ssh + - echo "$ALPHA_SSH_KEY" > ~/.ssh/id_ed25519 + - chmod 600 ~/.ssh/id_ed25519 + - ssh -o StrictHostKeyChecking=no deploy@alpha.mintel.me "cd /opt/alpha/sites/mb-grid-solutions && docker compose pull && docker compose up -d" + when: + branch: + - main + event: + - push + +volumes: + - name: dockersock + host: + path: /var/run/docker.sock \ No newline at end of file