java11/.gitlab-ci.yml

62 lines
1.3 KiB
YAML
Raw Permalink 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
2020-09-28 01:17:21 +05:00
DOCKER_TCP_PORT: 2375
2020-09-28 00:40:35 +05:00
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:
2020-09-28 01:25:14 +05:00
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
2020-09-28 01:31:06 +05:00
- docker login -u "$DOCKERHUB_USER" -p "$DOCKERHUB_PASSWORD"
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
2020-11-20 18:59:36 +05:00
only:
- master
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:
2020-09-28 01:17:21 +05:00
- docker build --pull -t $DOCKERHUB_IMAGE_LATEST .
2020-09-28 01:14:16 +05:00
- docker push $DOCKERHUB_IMAGE_LATEST
2020-11-20 18:59:36 +05:00
only:
- master
2020-09-28 01:14:16 +05:00
build-dockerhub-version:
stage: build
tags:
- docker
script:
2020-09-28 01:17:21 +05:00
- docker build --pull -t $DOCKERHUB_IMAGE_TAGGED .
2020-09-28 01:14:16 +05:00
- docker push $DOCKERHUB_IMAGE_TAGGED
only:
- tags