CI/CD Version 1
This commit is contained in:
parent
5869e05c33
commit
621becebdc
1 changed files with 69 additions and 0 deletions
69
.gitlab-ci.yml
Normal file
69
.gitlab-ci.yml
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
# avoids unecessary repulling of node modules
|
||||||
|
cache:
|
||||||
|
paths:
|
||||||
|
- page-test/node_modules/
|
||||||
|
|
||||||
|
stages:
|
||||||
|
- lint
|
||||||
|
#- test
|
||||||
|
- build
|
||||||
|
- deploy
|
||||||
|
|
||||||
|
variables:
|
||||||
|
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
|
||||||
|
IAMGE_LATES: $CI_REGISTRY_IMAGE:latest
|
||||||
|
|
||||||
|
|
||||||
|
.node:
|
||||||
|
image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/node:latest
|
||||||
|
|
||||||
|
|
||||||
|
.docker:
|
||||||
|
image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/docker:20
|
||||||
|
|
||||||
|
|
||||||
|
linter:
|
||||||
|
image: !reference [.node, image]
|
||||||
|
stage: lint
|
||||||
|
before_script:
|
||||||
|
- cd page-test
|
||||||
|
- yarn install
|
||||||
|
script:
|
||||||
|
- yarn lint
|
||||||
|
|
||||||
|
|
||||||
|
build:
|
||||||
|
image: !reference [.docker, image]
|
||||||
|
stage: build
|
||||||
|
variables:
|
||||||
|
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_BRANCH
|
||||||
|
CACHING:
|
||||||
|
before_script:
|
||||||
|
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
|
||||||
|
script:
|
||||||
|
- docker build $CACHING -t $IMAGE_TAG .
|
||||||
|
after_script:
|
||||||
|
- docker save $IMAGE_TAG > docker.tar
|
||||||
|
artifacts:
|
||||||
|
expire_in: 30 mins
|
||||||
|
paths:
|
||||||
|
- docker.tar
|
||||||
|
only:
|
||||||
|
- tags
|
||||||
|
|
||||||
|
|
||||||
|
push:
|
||||||
|
image: !reference [.docker, image]
|
||||||
|
stage: deploy
|
||||||
|
needs:
|
||||||
|
- job: build
|
||||||
|
artifacts: true
|
||||||
|
before_script:
|
||||||
|
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
|
||||||
|
- docker load -i docker.tar
|
||||||
|
script:
|
||||||
|
- docker tag $IMAGE_TAG $IMAGE_LATEST
|
||||||
|
- docker push $IMAGE_TAG
|
||||||
|
- docker push $IMAGE_LATEST
|
||||||
|
only:
|
||||||
|
- tags
|
Reference in a new issue