vegvisir/.drone.yml
Piotr Biernat 6bc22c2b6b
All checks were successful
continuous-integration/drone/push Build is passing
[test] Multistage build with drone CI
2022-04-17 00:38:48 +02:00

71 lines
1.4 KiB
YAML

kind: pipeline
type: docker
name: default
steps:
- name: static_check
image: golang:1.18
commands:
- go install honnef.co/go/tools/cmd/staticcheck@latest
- staticcheck ./pkg/...
volumes:
- name: gopath
path: /go
- name: lint
image: golang:1.18
commands:
- go install golang.org/x/lint/golint@latest
- golint -set_exit_status ./pkg/...
volumes:
- name: gopath
path: /go
- name: vet
image: golang:1.18
commands:
- go vet ./pkg/...
volumes:
- name: gopath
path: /go
- name: build_image
image: plugins/docker
commands:
- p1=$(echo $CI_COMMIT_BRANCH | cut -d '/' -f1) &&
p2=$(echo $CI_COMMIT_BRANCH | cut -d '/' -f2) &&
docker build -t git.pbiernat.dev/golang/vegvisir:$p1-$p2 -f Dockerfile.build .
volumes:
- name: docker-sock
path: /var/run
- name: push_image
image: plugins/docker
environment:
DOCKER_USERNAME:
from_secret: registry_username
DOCKER_PASSWORD:
from_secret: registry_password
commands:
- p1=$(echo $CI_COMMIT_BRANCH | cut -d '/' -f1) &&
p2=$(echo $CI_COMMIT_BRANCH | cut -d '/' -f2) &&
docker login git.pbiernat.dev -u $DOCKER_USERNAME -p $DOCKER_PASSWORD &&
docker push git.pbiernat.dev/golang/vegvisir:$p1-$p2
volumes:
- name: docker-sock
path: /var/run
services:
- name: docker
image: docker:dind
privileged: true
volumes:
- name: docker-sock
path: /var/run
volumes:
- name: gopath
temp: {}
- name: docker-sock
temp: {}