Guest User

Untitled

a guest
Jul 15th, 2020
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. stages:
  2. - back pre-build
  3. - back build
  4.  
  5. pre-build:
  6. stage: back pre-build
  7. only:
  8. refs:
  9. - master
  10. changes:
  11. - api/**/*
  12. before_script:
  13. - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
  14. script:
  15. - cp api/.env.build api/.env
  16. - docker run --volume $PWD/api:/app $BUILD_REGISTRY/composer.pcntl install --no-dev
  17. - docker run --volume $PWD/api:/app $BUILD_REGISTRY/php:7.2-cli sh -c "docker-php-ext-install pdo_mysql pcntl; cd app; php artisan migrate --force"
  18. - mv api req_api
  19. - API_NGINX_BUILD=$CI_COMMIT_SHA
  20. artifacts:
  21. paths:
  22. - req_api/
  23.  
  24. build api-nginx:
  25. stage: back build
  26. when: on_success
  27. only:
  28. - master
  29. before_script:
  30. - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
  31. - echo $API_NGINX_BUILD
  32. script:
  33. - docker pull $CI_REGISTRY_IMAGE/api-nginx:latest || true
  34. - envsubst < Dockerfile.nginx |
  35. docker build
  36. --pull
  37. --cache-from $CI_REGISTRY_IMAGE/api-nginx:latest
  38. --tag $CI_REGISTRY_IMAGE/api-nginx:$CI_COMMIT_SHA
  39. --file - .
  40. - docker push $CI_REGISTRY_IMAGE/api-nginx:$CI_COMMIT_SHA
  41. - docker tag $CI_REGISTRY_IMAGE/api-nginx:$CI_COMMIT_SHA $CI_REGISTRY_IMAGE/api-nginx:latest
  42. - docker push $CI_REGISTRY_IMAGE/api-nginx:latest
  43. needs:
  44. - project: test
  45. # - project: $CI_PROJECT_PATH
  46. job: pre-build
  47. ref: master
  48. artifacts: true
Add Comment
Please, Sign In to add comment