2023-03-10 22:24:23 +01:00
|
|
|
kind: pipeline
|
2023-03-10 22:40:31 +01:00
|
|
|
type: docker
|
2023-03-10 22:24:23 +01:00
|
|
|
name: default
|
|
|
|
|
|
|
|
trigger:
|
|
|
|
branch:
|
2023-03-10 22:33:17 +01:00
|
|
|
- main
|
2023-03-10 22:24:23 +01:00
|
|
|
|
2023-03-10 23:37:17 +01:00
|
|
|
platform:
|
|
|
|
os: linux
|
|
|
|
arch: amd64
|
|
|
|
|
2023-03-10 22:24:23 +01:00
|
|
|
steps:
|
2023-03-10 23:37:17 +01:00
|
|
|
# Run go tests
|
|
|
|
- name: go-test
|
2023-03-10 22:24:23 +01:00
|
|
|
image: golang
|
|
|
|
volumes:
|
|
|
|
- name: deps
|
|
|
|
path: /go
|
|
|
|
commands:
|
|
|
|
- cd src
|
|
|
|
- go test
|
|
|
|
|
2023-03-10 23:37:17 +01:00
|
|
|
# Build go binaries
|
|
|
|
- name: go-build-bin-amd64
|
2023-03-10 22:24:23 +01:00
|
|
|
image: golang
|
|
|
|
volumes:
|
|
|
|
- name: deps
|
|
|
|
path: /go
|
|
|
|
- name: bin
|
|
|
|
path: /binaries
|
|
|
|
commands:
|
|
|
|
- cd src
|
|
|
|
- go build -o /binaries/app
|
2023-03-10 23:37:17 +01:00
|
|
|
depends_on:
|
|
|
|
- go-test
|
|
|
|
|
|
|
|
# Build Containers for each architecture
|
|
|
|
- name: docker-build-image-amd64
|
2023-03-10 23:53:49 +01:00
|
|
|
image: plugins/docker # Check Entrypoint
|
|
|
|
volumes:
|
2023-03-10 23:37:17 +01:00
|
|
|
- name: docker_socket
|
|
|
|
path: /var/run/docker.sock
|
|
|
|
privileged: true
|
|
|
|
settings:
|
|
|
|
username:
|
|
|
|
from_secret: gitea_username
|
|
|
|
password:
|
|
|
|
from_secret: gitea_password
|
|
|
|
repo: gitea.voser.cloud/container/iwilldie
|
|
|
|
registry: https://gitea.voser.cloud
|
|
|
|
tags:
|
|
|
|
- ${DRONE_COMMIT_BRANCH}
|
|
|
|
- latest
|
|
|
|
platforms: linux/amd64
|
|
|
|
dockerfile: ./Docker/Dockerfile
|
|
|
|
depends_on:
|
|
|
|
- "go-build-bin-amd64"
|
|
|
|
|
2023-03-10 23:53:02 +01:00
|
|
|
# Run go tests
|
|
|
|
- name: binary-cleanup
|
|
|
|
image: alpine:latest
|
|
|
|
volumes:
|
|
|
|
- name: bin
|
|
|
|
path: /binaries
|
|
|
|
commands:
|
|
|
|
- rm -rf /binaries/*
|
|
|
|
when:
|
|
|
|
status:
|
|
|
|
- failure
|
|
|
|
- success
|
2023-03-10 23:56:17 +01:00
|
|
|
depends_on:
|
|
|
|
- "go-build-bin-amd64"
|
|
|
|
- docker-build-image-amd64
|
|
|
|
|
2023-03-10 23:53:02 +01:00
|
|
|
|
2023-03-10 23:37:17 +01:00
|
|
|
# Volumes to mount between steps
|
2023-03-10 22:24:23 +01:00
|
|
|
volumes:
|
|
|
|
- name: deps
|
|
|
|
temp: {}
|
|
|
|
- name: bin
|
2023-03-10 23:53:02 +01:00
|
|
|
host:
|
|
|
|
path: /tmp/bin
|
2023-03-10 23:40:10 +01:00
|
|
|
- name: docker_socket
|
|
|
|
host:
|
|
|
|
path: /var/run/docker.sock
|