Created
June 3, 2021 19:38
-
-
Save aelnonym/07f808dafafafae2031fc89b3b62eafb to your computer and use it in GitHub Desktop.
CI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| stages: | |
| - build | |
| - test | |
| variables: | |
| IMAGE_TAG: $CI_REGISTRY_IMAGE:latest | |
| docker: | |
| image: docker:latest | |
| services: | |
| - docker:dind | |
| stage: build | |
| variables: | |
| IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME | |
| before_script: | |
| - docker login -u "$CI_REGISTRY_USER" -p $CI_JOB_TOKEN $CI_REGISTRY | |
| script: | |
| - docker build -t $IMAGE_TAG . | |
| - docker push $IMAGE_TAG | |
| - | | |
| if [ $CI_COMMIT_REF_NAME == "docker" ]; then | |
| docker tag $IMAGE_TAG $CI_REGISTRY_IMAGE:latest; | |
| docker push $CI_REGISTRY_IMAGE:latest; | |
| fi | |
| only: | |
| - docker | |
| - release | |
| test-node: | |
| image: $IMAGE_TAG | |
| stage: test | |
| script: | |
| - cd app | |
| - npm install | |
| - node index.js & | |
| # - node server/index.js & | |
| - sleep 45 | |
| - wget 0.0.0.0:8082 | |
| - cat index.html | |
| - curl localhost:8082 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment