Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- stages:
- - back pre-build
- - back build
- pre-build:
- stage: back pre-build
- only:
- refs:
- - master
- changes:
- - api/**/*
- before_script:
- - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- script:
- - cp api/.env.build api/.env
- - docker run --volume $PWD/api:/app $BUILD_REGISTRY/composer.pcntl install --no-dev
- - 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"
- - mv api req_api
- - API_NGINX_BUILD=$CI_COMMIT_SHA
- artifacts:
- paths:
- - req_api/
- build api-nginx:
- stage: back build
- when: on_success
- only:
- - master
- before_script:
- - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- - echo $API_NGINX_BUILD
- script:
- - docker pull $CI_REGISTRY_IMAGE/api-nginx:latest || true
- - envsubst < Dockerfile.nginx |
- docker build
- --pull
- --cache-from $CI_REGISTRY_IMAGE/api-nginx:latest
- --tag $CI_REGISTRY_IMAGE/api-nginx:$CI_COMMIT_SHA
- --file - .
- - docker push $CI_REGISTRY_IMAGE/api-nginx:$CI_COMMIT_SHA
- - docker tag $CI_REGISTRY_IMAGE/api-nginx:$CI_COMMIT_SHA $CI_REGISTRY_IMAGE/api-nginx:latest
- - docker push $CI_REGISTRY_IMAGE/api-nginx:latest
- needs:
- - project: test
- # - project: $CI_PROJECT_PATH
- job: pre-build
- ref: master
- artifacts: true
Add Comment
Please, Sign In to add comment