try to login to registry

This commit is contained in:
Cyryl Płotnicki 2019-01-20 16:20:01 +00:00
parent d0a9ac0090
commit 0d40e1fe37

View file

@ -3,24 +3,36 @@ image:fedora:
image: docker:stable image: docker:stable
services: services:
- docker:dind - docker:dind
script: before_script:
- docker info - docker info
- docker login registry.gitlab.com - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN registry.gitlab.com
script:
- docker pull $CONTAINER_IMAGE:latest || true
- docker build --cache-from $CONTAINER_IMAGE:latest --tag $CONTAINER_IMAGE:$CI_COMMIT_SHA --tag $CONTAINER_IMAGE:latest .
- docker push $CONTAINER_IMAGE:$CI_COMMIT_SHA
- docker push $CONTAINER_IMAGE:latest
variables: variables:
DOCKER_HOST: tcp://docker:2375/ DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2 DOCKER_DRIVER: overlay2
CONTAINER_IMAGE: registry.gitlab.com/$CI_PROJECT_PATH/fedora
image:ubuntu: image:ubuntu:
stage: build stage: build
image: docker:stable image: docker:stable
services: services:
- docker:dind - docker:dind
script: before_script:
- docker info - docker info
- docker login registry.gitlab.com - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN registry.gitlab.com
script:
- docker pull $CONTAINER_IMAGE:latest || true
- docker build --cache-from $CONTAINER_IMAGE:latest --tag $CONTAINER_IMAGE:$CI_COMMIT_SHA --tag $CONTAINER_IMAGE:latest .
- docker push $CONTAINER_IMAGE:$CI_COMMIT_SHA
- docker push $CONTAINER_IMAGE:latest
variables: variables:
DOCKER_HOST: tcp://docker:2375/ DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2 DOCKER_DRIVER: overlay2
CONTAINER_IMAGE: registry.gitlab.com/$CI_PROJECT_PATH/ubuntu
fedora: fedora:
before_script: before_script: