diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 993fa6ef3a39107f32f85b6dc7b43015cc1d3ed1..4417493d18bb188f4b58fc9a622fe67afba55903 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -9,6 +9,7 @@ variables: ## PIPELINE DEFINITION stages: + - check - build - test - release @@ -22,6 +23,18 @@ stages: - registry.cyberbrain.pw/docker/dind before_script: - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY + - alias drr="docker run --rm -v \${PWD}:\${PWD} -w \${PWD}" + +########################################################################################################## + +#### CHECK SECTION +check: + <<: *common + stage: check + variables: + GIT_DEPTH: 1 + script: + - drr registry.cyberbrain.pw/tools/hadolint:latest hadolint --ignore DL3007 Dockerfile ########################################################################################################## @@ -31,10 +44,9 @@ build: stage: build variables: GIT_DEPTH: 1 - DIRECTORY: '.' script: - docker pull "${CI_REGISTRY_IMAGE}:latest" || true - - docker build --cache-from "${CI_REGISTRY_IMAGE}:latest" -t "${CI_REGISTRY_IMAGE}:temp-${CI_PIPELINE_IID}" -f "./${DIRECTORY}/Dockerfile" "./${DIRECTORY}" + - docker build --cache-from "${CI_REGISTRY_IMAGE}:latest" -t "${CI_REGISTRY_IMAGE}:temp-${CI_PIPELINE_IID}" -f ./Dockerfile . - docker push "${CI_REGISTRY_IMAGE}:temp-$CI_PIPELINE_IID" ########################################################################################################## @@ -43,14 +55,12 @@ build: test: <<: *common stage: test - services: - - "${CI_REGISTRY_IMAGE}:temp-$CI_PIPELINE_IID" variables: GIT_STRATEGY: "none" - GIT_DEPTH: 0 + services: + - "${CI_REGISTRY_IMAGE}:temp-$CI_PIPELINE_IID" script: - - docker info - - docker run --rm registry.cyberbrain.pw/docker/hello-world + - drr registry.cyberbrain.pw/docker/hello-world ########################################################################################################## @@ -60,7 +70,6 @@ release: stage: release variables: GIT_STRATEGY: "none" - GIT_DEPTH: 0 only: - /^development$/ - /^staging$/ diff --git a/Dockerfile b/Dockerfile index 97a6f45f26406735d15e945d7f0482617960a7e7..955109bf9341bf686f6bfb4eb2327c9d55406eb4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,3 @@ FROM docker:dind -MAINTAINER Dmitriy Safronov ENV LANG C.UTF-8