1
0
forked from zv0n/lunch-go

CI: deploy only on tag

This commit is contained in:
zvon 2023-08-25 13:52:42 +02:00
parent ca302ed6e3
commit ed16ea34db

View File

@ -1,19 +1,72 @@
---
kind: pipeline
type: kubernetes
name: build
platform:
os: linux
arch: amd64
steps:
- name: formatting-check
image: golang
commands:
- test -z $(gofmt -l .)
- name: build
image: docker:dind
volumes:
- name: dockersock
path: /var/run
commands:
- docker build -f Dockerfile .
services:
- name: docker
image: docker:dind
privileged: true
volumes:
- name: dockersock
path: /var/run
volumes:
- name: dockersock
temp: {}
---
kind: pipeline
type: kubernetes
name: deploy
platform:
os: linux
arch: amd64
steps:
- name: build
image: docker
- name: deploy
image: docker:dind
environment:
DOCKER_USERNAME:
from_secret: DOCKER_USERNAME
DOCKER_PASSWORD:
from_secret: DOCKER_PASSWORD
volumes:
- name: dockersock
path: /var/run
commands:
- echo "$DOCKER_USERNAME"
- docker login "docker.zvon.tech" --username "$DOCKER_USERNAME" --password "$DOCKER_PASSWORD"
- docker login "docker.zvon.tech" --username "$DOCKER_USERNAME" --password "$DOCKER_PASSWORD"
- docker buildx create --use
- docker buildx build -f Dockerfile -t "docker.zvon.tech/lunch-go:${DRONE_TAG}" --platform linux/amd64,linux/arm64 --push .
services:
- name: docker
image: docker:dind
privileged: true
volumes:
- name: dockersock
path: /var/run
volumes:
- name: dockersock
temp: {}
trigger:
event:
- tag