Commit 948f971f authored by Konstantin Kopper's avatar Konstantin Kopper

Added README and CI configuration

parent ed738706
stages:
- build
- deploy
image: docker:latest
services:
- docker:dind
variables:
DOCKER_DRIVER: overlay2
DOCKER_HOST: tcp://docker:2375
DOCKER_IMAGE: $CI_PROJECT_NAME:$CI_COMMIT_SHA
build:
stage: build
script:
- docker build --pull -t "$DOCKER_IMAGE" .
after_script:
- docker save -o "$DOCKER_IMAGE.tar" "$DOCKER_IMAGE"
artifacts:
paths:
- "$DOCKER_IMAGE.tar"
.registry: &registry
stage: deploy
before_script:
- echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" --password-stdin $CI_REGISTRY
- docker load -i "$DOCKER_IMAGE.tar"
after_script:
- docker logout $CI_REGISTRY
registry-latest:
<<: *registry
only:
- master
environment:
name: GitLab Registry
url: $CI_PROJECT_URL/container_registry
script:
- docker tag "$DOCKER_IMAGE" "$CI_REGISTRY_IMAGE:latest"
- docker push "$CI_REGISTRY_IMAGE:latest"
registry-tag:
<<: *registry
only:
- tags
script:
- docker tag "$DOCKER_IMAGE" "$CI_REGISTRY_IMAGE:$CI_COMMIT_TAG"
- docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_TAG"
.hub: &hub
stage: deploy
before_script:
- echo "$HUB_PASSWORD" | docker login -u "$GITLAB_USER_LOGIN" --password-stdin
- docker load -i "$DOCKER_IMAGE.tar"
after_script:
- docker logout
hub-latest:
<<: *hub
only:
- master
environment:
name: Docker Hub
url: https://hub.docker.com/r/$CI_PROJECT_PATH
script:
- docker tag "$DOCKER_IMAGE" "$CI_PROJECT_PATH:latest"
- docker push "$CI_PROJECT_PATH:latest"
hub-tag:
<<: *hub
only:
- tags
script:
- docker tag "$DOCKER_IMAGE" "$CI_PROJECT_PATH:$CI_COMMIT_TAG"
- docker push "$CI_PROJECT_PATH:$CI_COMMIT_TAG"
Docker image based on [`ubuntu:latest`](https://hub.docker.com/_/ubuntu/).
Originally created to run GitLab CI jobs requiring the Oracle JDK.
The resulting Docker image is automatically deployed to both [Docker Hub](https://hub.docker.com/r/kkopper/oraclejdk-gradle/) and this projects [container registry](https://gitlab.com/kkopper/oraclejdk-gradle/container_registry).
All created Docker tags correspond to tags in this repository, with `latest` always being the most recent commit on the master branch.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment