2018-01-22 03:53:05 +00:00
|
|
|
# build the go app, then wrap it in an image
|
|
|
|
stages:
|
|
|
|
- build
|
2018-03-31 14:35:30 +00:00
|
|
|
- test
|
|
|
|
- package
|
2018-01-22 03:53:05 +00:00
|
|
|
|
2018-03-31 14:35:30 +00:00
|
|
|
build:go:
|
2018-01-22 03:53:05 +00:00
|
|
|
stage: build
|
2018-03-10 16:25:15 +00:00
|
|
|
image: andrexus/golang-dep
|
2018-01-22 03:53:05 +00:00
|
|
|
tags:
|
|
|
|
- runner:k8s
|
2018-03-31 14:35:30 +00:00
|
|
|
|
2018-01-22 03:53:05 +00:00
|
|
|
script:
|
2018-03-11 22:54:19 +00:00
|
|
|
- time dep ensure
|
2018-03-10 16:25:15 +00:00
|
|
|
- go build
|
2018-03-31 14:35:30 +00:00
|
|
|
variables:
|
|
|
|
GOPATH: /build
|
|
|
|
|
2018-01-22 03:53:05 +00:00
|
|
|
artifacts:
|
|
|
|
paths:
|
2018-03-10 16:25:15 +00:00
|
|
|
- home-dns
|
2018-01-22 03:53:05 +00:00
|
|
|
expire_in: 1 hour
|
2018-03-09 03:45:51 +00:00
|
|
|
cache:
|
|
|
|
key: "${CI_COMMIT_REF_SLUG}"
|
|
|
|
untracked: true
|
2018-01-22 03:53:05 +00:00
|
|
|
|
2018-03-31 14:35:30 +00:00
|
|
|
package:docker:
|
|
|
|
stage: package
|
|
|
|
image: docker:stable
|
2018-01-22 03:53:05 +00:00
|
|
|
services:
|
2018-03-31 14:35:30 +00:00
|
|
|
- docker:stable-dind
|
2018-01-22 03:53:05 +00:00
|
|
|
tags:
|
|
|
|
- runner:k8s
|
2018-03-31 14:35:30 +00:00
|
|
|
|
|
|
|
dependencies:
|
|
|
|
- build:go
|
|
|
|
before_script:
|
2018-01-22 03:53:05 +00:00
|
|
|
- mkdir /root/.docker
|
|
|
|
- ln -s /secrets/docker /root/.docker/config.json
|
|
|
|
- docker info
|
2018-03-31 14:35:30 +00:00
|
|
|
script:
|
2018-01-22 03:53:05 +00:00
|
|
|
- docker build -t $IMAGE_TAG .
|
|
|
|
- docker push $IMAGE_TAG
|
|
|
|
variables:
|
|
|
|
DOCKER_DRIVER: overlay2
|
|
|
|
DOCKER_HOST: tcp://localhost:2375
|
|
|
|
IMAGE_TAG: ssube/home-dns:$CI_COMMIT_REF_SLUG
|