.gitlab-ci.yml 823 Bytes
Newer Older
1 2 3 4 5 6 7 8 9
image: alpinelinux/docker-cli:latest
stages:
  - build
  - upload

build:
  stage: build
  tags:
    - docker-alpine
10
    - ci-docker-image
11 12
    - x86_64
  script:
13 14 15 16 17 18 19 20 21 22
    - docker build --no-cache -t $CI_PROJECT_NAME:latest .
  after_script:
    - mkdir -p docker-images
    - >
      docker image save $CI_PROJECT_NAME:latest | gzip - >
      docker-images/${CI_PROJECT_NAME}_latest.tar.gz
  artifacts:
    paths:
      - docker-images/*.tar.gz
    expire_in: 1h
23 24 25

upload:
  stage: upload
26 27 28 29
  tags:
    - docker-alpine
    - ci-docker-image
    - x86_64
30
  before_script:
31
    - docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
32
    - gunzip -c docker-images/${CI_PROJECT_NAME}_latest.tar.gz | docker image load
33 34 35 36
  only:
    - master
  script:
    - docker-push-image $CI_PROJECT_NAME:latest $DOCKER_NAMESPACE/$CI_PROJECT_NAME:latest