kind: pipeline type: docker name: default platform: os: linux arch: amd64 steps: # Run go tests - name: go-test image: golang volumes: - name: deps path: /go commands: - cd src - go test # Build go binaries - name: go-build-bin-amd64 image: golang volumes: - name: deps path: /go - name: binaries path: /binaries commands: - cd src - go build -o /binaries/app depends_on: - go-test # Build Containers for each architecture PROD - name: docker-build-image-amd64-prod image: thegeeklab/drone-docker-buildx volumes: - name: docker_socket path: /var/run/docker.sock - name: binaries path: /drone/src/binaries/ privileged: true commands: settings: username: from_secret: gitea_username password: from_secret: gitea_password repo: gitea.voser.cloud/container/iwilldie registry: https://gitea.voser.cloud auto_tag: true tags: - latest platforms: linux/amd64 dockerfile: /drone/src/Docker/Dockerfile.amd64 nocache: true depends_on: - "go-build-bin-amd64" when: branch: - main # Build Containers for each architecture DEV - name: docker-build-image-amd64-dev image: thegeeklab/drone-docker-buildx volumes: - name: docker_socket path: /var/run/docker.sock - name: binaries path: /drone/src/binaries/ privileged: true commands: settings: username: from_secret: gitea_username password: from_secret: gitea_password repo: gitea.voser.cloud/container/iwilldie registry: https://gitea.voser.cloud tags: - latest auto_tag_suffix: -dev platforms: linux/amd64 dockerfile: /drone/src/Docker/Dockerfile.amd64 nocache: true depends_on: - "go-build-bin-amd64" when: branch: - dev # Build Containers for each architecture TAGGED - name: docker-build-image-amd64-tagged image: thegeeklab/drone-docker-buildx volumes: - name: docker_socket path: /var/run/docker.sock - name: binaries path: /drone/src/binaries/ privileged: true commands: settings: username: from_secret: gitea_username password: from_secret: gitea_password repo: gitea.voser.cloud/container/iwilldie registry: https://gitea.voser.cloud auto_tag: true auto_tag_suffix: platforms: linux/amd64 dockerfile: /drone/src/Docker/Dockerfile.amd64 nocache: true depends_on: - "go-build-bin-amd64" when: event: - tag # Run go tests - name: binary-cleanup image: alpine:latest volumes: - name: binaries path: /binaries commands: - rm -rf /binaries/* when: status: - failure - success depends_on: - "go-build-bin-amd64" - "docker-build-image-amd64-dev" - "docker-build-image-amd64-prod" - "docker-build-image-amd64-tagged" # Volumes to mount between steps volumes: - name: deps temp: {} - name: binaries temp: {} - name: docker_socket host: path: /var/run/docker.sock