iwilldie/.drone.yml

122 lines
2.3 KiB
YAML
Raw Permalink Normal View History

2023-03-10 22:24:23 +01:00
kind: pipeline
type: docker
2023-03-10 22:24:23 +01:00
name: default
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
2023-03-11 00:39:48 +01:00
- name: binaries
2023-03-10 22:24:23 +01:00
path: /binaries
commands:
- cd src
- go build -o /binaries/app
2023-03-10 23:37:17 +01:00
depends_on:
- go-test
2023-03-11 01:19:28 +01:00
# Build Containers for each architecture PROD
2023-03-11 01:20:57 +01:00
- name: docker-build-image-amd64-prod
2023-03-11 00:48:30 +01:00
image: thegeeklab/drone-docker-buildx
2023-03-10 23:53:49 +01:00
volumes:
2023-03-10 23:37:17 +01:00
- name: docker_socket
path: /var/run/docker.sock
2023-03-11 00:39:48 +01:00
- name: binaries
2023-03-11 00:57:03 +01:00
path: /drone/src/binaries/
2023-03-10 23:37:17 +01:00
privileged: true
2023-03-11 00:34:16 +01:00
commands:
2023-03-10 23:37:17 +01:00
settings:
username:
from_secret: gitea_username
password:
from_secret: gitea_password
repo: gitea.voser.cloud/container/iwilldie
registry: https://gitea.voser.cloud
2023-03-11 01:19:28 +01:00
auto_tag: true
2023-03-10 23:37:17 +01:00
tags:
- latest
platforms: linux/amd64
2023-03-11 00:53:44 +01:00
dockerfile: /drone/src/Docker/Dockerfile.amd64
2023-03-11 00:15:16 +01:00
nocache: true
2023-03-10 23:37:17 +01:00
depends_on:
- "go-build-bin-amd64"
2023-03-11 01:19:28 +01:00
when:
event:
- tag
branch:
- main
# Build Containers for each architecture DEV
2023-03-11 01:20:57 +01:00
- name: docker-build-image-amd64-dev
2023-03-11 01:19:28 +01:00
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: dev
platforms: linux/amd64
dockerfile: /drone/src/Docker/Dockerfile.amd64
nocache: true
depends_on:
- "go-build-bin-amd64"
when:
event:
- tag
branch:
- dev
2023-03-10 23:37:17 +01:00
2023-03-10 23:53:02 +01:00
# Run go tests
- name: binary-cleanup
image: alpine:latest
volumes:
2023-03-11 00:39:48 +01:00
- name: binaries
2023-03-10 23:53:02 +01:00
path: /binaries
commands:
- rm -rf /binaries/*
when:
status:
- failure
- success
2023-03-10 23:56:17 +01:00
depends_on:
- "go-build-bin-amd64"
2023-03-11 01:20:57 +01:00
- "docker-build-image-amd64-dev"
- "docker-build-image-amd64-prod"
2023-03-10 23:56:17 +01:00
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: {}
2023-03-11 00:39:48 +01:00
- name: binaries
2023-03-10 23:58:23 +01:00
temp: {}
2023-03-10 23:40:10 +01:00
- name: docker_socket
host:
path: /var/run/docker.sock