Updated gitlab-ci.yml to remove images after push and build
This commit is contained in:
parent
22a92f7525
commit
768ec31a42
@ -1,39 +1,43 @@
|
|||||||
variables:
|
variables:
|
||||||
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
|
IMAGE_TAG: $CI_REGISTRY_IMAGE:CI_COMMIT_SHORT_SHA
|
||||||
IMAGE_TAG_LATEST: $CI_REGISTRY_IMAGE:latest
|
IMAGE_TAG_LATEST: $CI_REGISTRY_IMAGE:latest
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
- build-eleventy
|
- eleventy
|
||||||
- docker-build
|
- docker_build
|
||||||
|
|
||||||
build-eleventy:
|
before_script:
|
||||||
stage: build-eleventy
|
- docker info
|
||||||
|
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
|
||||||
|
|
||||||
|
eleventy:
|
||||||
|
stage: eleventy
|
||||||
image: node:latest
|
image: node:latest
|
||||||
cache:
|
cache:
|
||||||
paths:
|
paths:
|
||||||
- node_modules/
|
- node_modules/
|
||||||
script:
|
script:
|
||||||
|
|
||||||
- npm install
|
- npm install
|
||||||
- npm run build
|
- npm run build
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- _site/
|
- _site/
|
||||||
only:
|
only:
|
||||||
- tags
|
- master
|
||||||
|
|
||||||
docker-build:
|
docker_build:
|
||||||
services:
|
services:
|
||||||
- docker:dind
|
- docker:dind
|
||||||
stage: docker-build
|
stage: docker_build
|
||||||
image: docker:latest
|
image: docker:latest
|
||||||
script:
|
script:
|
||||||
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
|
|
||||||
- docker build --no-cache --pull -t $IMAGE_TAG .
|
- docker build --no-cache --pull -t $IMAGE_TAG .
|
||||||
- docker push $IMAGE_TAG
|
- docker push $IMAGE_TAG
|
||||||
- docker tag $IMAGE_TAG $IMAGE_TAG_LATEST
|
- docker tag $IMAGE_TAG $IMAGE_TAG_LATEST
|
||||||
- docker push $IMAGE_TAG_LATEST
|
- docker push $IMAGE_TAG_LATEST
|
||||||
- docker rmi $IMAGE_TAG $IMAGE_TAG_LATEST
|
- docker rmi $IMAGE_TAG $IMAGE_TAG_LATEST
|
||||||
|
|
||||||
only:
|
only:
|
||||||
- tags
|
- master
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user