.gitlab-ci.yml 593 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12
# Official docker image.
image: docker:latest

services:
  - docker:dind

before_script:
  - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY

build-master:
  stage: build
  script:
13
    - docker build --pull -t "$CI_REGISTRY_IMAGE" --build-arg "commit_ref=${CI_COMMIT_SHA}" .
14 15 16 17 18 19 20
    - docker push "$CI_REGISTRY_IMAGE"
  only:
    - master

build:
  stage: build
  script:
21
    - docker build --pull -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"  --build-arg "commit_ref=${CI_COMMIT_SHA}" .
22 23 24
    - docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
  except:
    - master