version: 2 jobs: build: docker: - image: docker working_directory: ~/socks5-server steps: - setup_remote_docker - run: name: Install Docker client command: | set -x VER="17.03.0-ce" curl -L -o /tmp/docker-$VER.tgz https://get.docker.com/builds/Linux/x86_64/docker-$VER.tgz tar -xz -C /tmp -f /tmp/docker-$VER.tgz mv /tmp/docker/* /usr/bin - run: name: Build Docker image command: docker build -t serjs/go-socks5-proxy . - deploy: command: | docker login -u $DOCKERHUB_USER -p $DOCKERHUB_PASSWORD if [ $CIRCLE_TAG -ne "undefined" ]; then docker tag serjs/go-socks5-proxy serjs/go-socks5-proxy:$CIRCLE_TAG docker push serjs/go-socks5-proxy:$CIRCLE_TAG else docker tag serjs/go-socks5-proxy serjs/go-socks5-proxy:dev docker push serjs/go-socks5-proxy:dev fi