41 lines
784 B
YAML
41 lines
784 B
YAML
image: docker:latest
|
|
|
|
stages:
|
|
- test
|
|
- build
|
|
|
|
services:
|
|
- registry.leenooks.net/leenooks/ci-docker:dind
|
|
|
|
variables:
|
|
VERSION: latest
|
|
DOCKER_HOST: tcp://registry.leenooks.net-leenooks-ci-docker:2375
|
|
|
|
before_script:
|
|
- cat /etc/hosts
|
|
- env|sort
|
|
- test -n "${REGISTRY}" # Needs to be set in project
|
|
- test -n "${IMAGE}" # Needs to be set in project
|
|
- docker info
|
|
- docker version
|
|
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN ${REGISTRY}
|
|
|
|
test:
|
|
stage: test
|
|
script:
|
|
- docker build -t ${IMAGE}:${VERSION} .
|
|
- docker images
|
|
only:
|
|
- debug
|
|
|
|
build:
|
|
stage: build
|
|
script:
|
|
- docker build -t ${IMAGE}:${VERSION} .
|
|
- docker tag ${IMAGE}:${VERSION} ${REGISTRY}/${IMAGE}:${VERSION}
|
|
- docker push ${REGISTRY}/${IMAGE}:${VERSION}
|
|
tags:
|
|
- docker
|
|
only:
|
|
- master
|