More on CI.

This commit is contained in:
Stanislav Nikitin 2020-09-28 01:14:16 +05:00
parent 3061d0bacd
commit 945e4bea6a
No known key found for this signature in database
GPG Key ID: 106900B32F8192EE

View File

@ -1,11 +1,15 @@
image: docker:19.03.13 image: docker:19.03.13
services: services:
- docker:19.03.12-dind - docker:19.03.13-dind
variables: variables:
DOCKER_HOST: tcp://docker:2375 DOCKER_HOST: tcp://docker:2375
DOCKER_TLS_CERTDIR: "" DOCKER_TLS_CERTDIR: ""
LOCAL_REGISTRY_IMAGE_LATEST: $CI_REGISTRY_IMAGE:latest
LOCAL_REGISTRY_IMAGE_TAGGED: $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
DOCKERHUB_IMAGE_LATEST: pztrn/java:latest
DOCKERHUB_IMAGE_TAGGED: pztrn/java:$CI_COMMIT_TAG
stages: stages:
- build - build
@ -19,15 +23,35 @@ build-local-registry-latest:
tags: tags:
- docker - docker
script: script:
- docker build --pull -t $CI_REGISTRY_IMAGE:latest . - docker build --pull -t $LOCAL_REGISTRY_IMAGE_LATEST .
- docker push $CI_REGISTRY_IMAGE:latest - docker push $LOCAL_REGISTRY_IMAGE_LATEST
build-local-registry-version: build-local-registry-version:
stage: build stage: build
tags: tags:
- docker - docker
script: script:
- docker build --pull -t $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG . - docker build --pull -t $LOCAL_REGISTRY_IMAGE_TAGGED .
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG - docker push $LOCAL_REGISTRY_IMAGE_TAGGED
only:
- tags
build-dockerhub-latest:
stage: build
tags:
- docker
script:
- docker login -u $DOCKERHUB_USER -p $DOCKERHUB_PASSWORD
- docker build --pull -t $DOCKERHUB_IMAGE_LATEST
- docker push $DOCKERHUB_IMAGE_LATEST
build-dockerhub-version:
stage: build
tags:
- docker
script:
- docker login -u $DOCKERHUB_USER -p $DOCKERHUB_PASSWORD
- docker build --pull -t $DOCKERHUB_IMAGE_TAGGED
- docker push $DOCKERHUB_IMAGE_TAGGED
only: only:
- tags - tags