Demo entry 6754522

gitlab-ci

   

Submitted by anonymous on Jul 15, 2018 at 16:40
Language: YAML. Code size: 1.0 kB.

image: docker:latest

services:
  - docker:dind

build:
  stage: build
  script:
  - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN registry.gitlab.com
  - docker build -t registry.gitlab.com/clnr/ci-testproject .
  - docker run registry.gitlab.com/clnr/ci-testproject java -version
  - docker push registry.gitlab.com/clnr/ci-testproject

test:
  stage: test
  image: registry.gitlab.com/clnr/ci-testproject
  script:
  - pwd
  - ls -la

docker_on_change:
  stage: build
  image: docker:git
  script:
  - alias 'dockerize=git whatchanged HEAD^! | grep Dockerfile >/dev/null'
  - dockerize || (echo "no need to build dockerfile!")
  - dockerize || exit 0
  - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN registry.gitlab.com
  - dockerize && docker build -t registry.gitlab.com/clnr/ci-testproject .
  - dockerize && docker tag registry.gitlab.com/clnr/ci-testproject registry.gitlab.com/clnr/ci-testproject:onchange 
  - dockerize && docker push registry.gitlab.com/clnr/ci-testproject:onchange 

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).