java11/.gitlab-ci.yml

58 lines
1.3 KiB
YAML
Raw Normal View History

2020-09-28 00:37:56 +05:00
image: docker:19.03.13
2020-09-28 00:34:04 +05:00
2020-09-28 00:40:35 +05:00
services:
2020-09-28 01:14:16 +05:00
- docker:19.03.13-dind
2020-09-28 00:40:35 +05:00
variables:
DOCKER_HOST: tcp://docker:2375
DOCKER_TLS_CERTDIR: ""
2020-09-28 01:14:16 +05:00
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
2020-09-28 00:40:35 +05:00
stages:
- build
before_script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN registry.gitlab.pztrn.name
2020-09-28 00:40:35 +05:00
- docker info
build-local-registry-latest:
stage: build
2020-09-28 00:25:46 +05:00
tags:
- docker
script:
2020-09-28 01:14:16 +05:00
- docker build --pull -t $LOCAL_REGISTRY_IMAGE_LATEST .
- docker push $LOCAL_REGISTRY_IMAGE_LATEST
build-local-registry-version:
stage: build
2020-09-28 00:25:46 +05:00
tags:
- docker
script:
2020-09-28 01:14:16 +05:00
- docker build --pull -t $LOCAL_REGISTRY_IMAGE_TAGGED .
- 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:
- tags