2018-01-22 03:53:05 +00:00
|
|
|
# build the go app, then wrap it in an image
|
|
|
|
stages:
|
|
|
|
- build
|
|
|
|
- image
|
|
|
|
|
|
|
|
build:app:
|
|
|
|
stage: build
|
2018-02-05 05:10:13 +00:00
|
|
|
image: golang:1.9
|
2018-01-22 03:53:05 +00:00
|
|
|
tags:
|
|
|
|
- runner:k8s
|
|
|
|
script:
|
2018-01-22 04:12:21 +00:00
|
|
|
- go get home-dns
|
|
|
|
- go build home-dns
|
2018-01-22 03:53:05 +00:00
|
|
|
artifacts:
|
|
|
|
paths:
|
2018-01-22 04:12:21 +00:00
|
|
|
- bin/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 04:12:21 +00:00
|
|
|
variables:
|
|
|
|
GOPATH: "${CI_PROJECT_DIR}"
|
2018-01-22 03:53:05 +00:00
|
|
|
|
|
|
|
build:image:
|
|
|
|
stage: image
|
|
|
|
image: docker
|
|
|
|
services:
|
|
|
|
- docker:dind
|
|
|
|
tags:
|
|
|
|
- runner:k8s
|
|
|
|
script:
|
|
|
|
# prep secrets
|
|
|
|
- mkdir /root/.docker
|
|
|
|
- ln -s /secrets/docker /root/.docker/config.json
|
|
|
|
- docker info
|
|
|
|
# build it
|
|
|
|
- docker build -t $IMAGE_TAG .
|
|
|
|
- docker push $IMAGE_TAG
|
|
|
|
dependencies:
|
|
|
|
- build:app
|
|
|
|
variables:
|
|
|
|
DOCKER_DRIVER: overlay2
|
|
|
|
DOCKER_HOST: tcp://localhost:2375
|
|
|
|
IMAGE_TAG: ssube/home-dns:$CI_COMMIT_REF_SLUG
|