# build the go app, then wrap it in an image stages: - build - test - package .go: &go-job image: andrexus/golang-dep tags: - runner:k8s build:go: <<: *go-job stage: build script: - time dep ensure - time go build - time go test variables: GOPATH: /build artifacts: paths: - home-dns expire_in: 1 hour cache: key: "${CI_COMMIT_REF_SLUG}" policy: pull-push paths: - vendor package:docker: stage: package image: docker:stable services: - docker:stable-dind tags: - runner:k8s dependencies: - build:go before_script: - mkdir /root/.docker - ln -s /secrets/docker /root/.docker/config.json script: - docker info - 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