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

image: docker:stable
variables:
5
  IMAGE: $CI_REGISTRY_IMAGE
6
7
  DOCKER_HOST: tcp://docker:2375/
  DOCKER_DRIVER: overlay2
Nicolas Vuillermet's avatar
Nicolas Vuillermet committed
8
  DOCKER_TLS_VERIFY: ''
9
10
11
12
13
14
stages:
  - build
  - test
  - push

services:
Nicolas Vuillermet's avatar
Nicolas Vuillermet committed
15
  - docker:18.09.7-dind
16
17
18
19

Build docker image:
  stage: build
  before_script: &before_script
20
    - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY"
21
22
23
24
25
26
27
28
29
30
31
  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