.gitlab-ci.yml 650 Bytes
Newer Older
1
2
3
4
---

image: docker:stable
variables:
Nicolas Vuillermet's avatar
Nicolas Vuillermet committed
5
  IMAGE: $DOCKER_REGISTRY/public/ci-dind
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
  DOCKER_HOST: tcp://docker:2375/
  DOCKER_DRIVER: overlay2
stages:
  - build
  - test
  - push

services:
- docker:18-dind

Build docker image:
  stage: build
  before_script: &before_script
    - docker login $DOCKER_REGISTRY -u $DOCKER_REGISTRY_USER -p $DOCKER_REGISTRY_PASSWORD
  script:
    - docker build -t $IMAGE:$CI_COMMIT_SHA .
    - docker push $IMAGE:$CI_COMMIT_SHA

Push image:
  stage: push
  before_script: *before_script
  script:
    - docker pull $IMAGE:$CI_COMMIT_SHA
    - docker tag $IMAGE:$CI_COMMIT_SHA $IMAGE:latest
    - docker push $IMAGE:latest