--- kind: pipeline type: docker name: build platform: os: linux arch: amd64 steps: - name: scp image: appleboy/drone-scp settings: command_timeout: 2m host: from_secret: ssh-host key: from_secret: ssh-key port: from_secret: ssh-port source: - . target: /stack/squid username: from_secret: ssh-user - name: wait image: alpine commands: - sleep 15 - name: "dockerbuild docker image:" image: docker:dind commands: - set -e - pwd - sleep 15 - cd docker - docker login $${LOCAL_DOCKER_REGISTRY} --username client --password "$${LOCAL_REGISTRY_PASSWORD}" - docker build . -t $${LOCAL_DOCKER_REGISTRY}squid - docker push $${LOCAL_DOCKER_REGISTRY}squid - docker logout $${LOCAL_DOCKER_REGISTRY} environment: LOCAL_DOCKER_REGISTRY: from_secret: local-docker-registry LOCAL_REGISTRY_PASSWORD: from_secret: local-registry-password volumes: - name: dockersock path: /var/run - name: deploy squid image: appleboy/drone-ssh settings: envs: - drone_tag - drone_commit - drone_build_number - drone_repo_name - drone_repo_namespace - local_docker_registry - local_registry_password host: from_secret: ssh-host key: from_secret: ssh-key port: from_secret: ssh-port script: - set -e - docker network prune -f - cd /stack/squid/myCA - openssl genrsa -out CA_key.pem 2048 - openssl req -x509 -days 600 -new -nodes -key CA_key.pem -out CA_crt.pem -extensions v3_ca -config openssl.cnf -subj "/C=US/ST=California/L=Mountain View/O=Google/OU=Enterprise/CN=MyCA" - cd .. - docker stack rm squid - sleep 31 - export SQUID_IMAGE=$${LOCAL_DOCKER_REGISTRY}squid - docker login $${LOCAL_DOCKER_REGISTRY} --username client --password "$${LOCAL_REGISTRY_PASSWORD}" - docker pull $${SQUID_IMAGE} - docker stack deploy -c docker-compose.yml squid username: from_secret: ssh-user environment: LOCAL_DOCKER_REGISTRY: from_secret: local-docker-registry LOCAL_REGISTRY_PASSWORD: from_secret: local-registry-password services: - name: docker image: docker:dind privileged: true volumes: - name: dockersock path: /var/run - name: ca path: /etc/docker/certs.d volumes: - name: dockersock temp: {} - name: ca host: path: /etc/docker/certs.d ...