wip cicd
This commit is contained in:
parent
32e47c8d9c
commit
13bf55ffc3
2 changed files with 84 additions and 19 deletions
|
|
@ -1,24 +1,84 @@
|
|||
include:
|
||||
- project: 'ldc-web/shared-ci'
|
||||
ref: 'main'
|
||||
file: 'lint/lint.yml'
|
||||
- project: 'ldc-web/shared-ci'
|
||||
ref: 'main'
|
||||
file: 'security/security.yml'
|
||||
- project: 'ldc-web/shared-ci'
|
||||
ref: 'main'
|
||||
file: 'build/build.yml'
|
||||
- project: 'ldc-web/shared-ci'
|
||||
ref: 'main'
|
||||
file: 'test/test.yml'
|
||||
- project: 'ldc-web/shared-ci'
|
||||
ref: 'main'
|
||||
file: 'deploy/deploy.yml'
|
||||
composer-build:
|
||||
stage: build
|
||||
image: $CI_REGISTRY/ldc-web/projets/ldc-web-images-docker/ldcweb-qa-8.2:latest
|
||||
before_script:
|
||||
- composer config gitlab-token.lab.s-web.fr $CI_DEPLOY_USER $CI_DEPLOY_PASSWORD
|
||||
cache:
|
||||
paths:
|
||||
- vendor/
|
||||
script:
|
||||
- composer install --no-dev --optimize-autoloader --classmap-authoritative --no-scripts
|
||||
artifacts:
|
||||
expose_as: 'vendor'
|
||||
paths:
|
||||
- vendor
|
||||
allow_failure: false
|
||||
rules:
|
||||
- if: $CI_COMMIT_TAG != null && $APP_ENV != null
|
||||
|
||||
npm-build:
|
||||
stage: build
|
||||
image: $CI_REGISTRY/ldc-web/projets/ldc-web-images-docker/ldcweb-qa-8.2:latest
|
||||
before_script:
|
||||
- git submodule update init --recursive
|
||||
- php artisan theme:switch $APP_THEME_NAME
|
||||
- npm config set @ldc-web:registry https://${CI_SERVER_HOST}/api/v4/packages/npm/
|
||||
- npm config set -- '//${CI_SERVER_HOST}/api/v4/packages/npm/:_authToken' "${CI_DEPLOY_PASSWORD}"
|
||||
- npm install
|
||||
cache:
|
||||
paths:
|
||||
- public/
|
||||
script:
|
||||
- npm run prod
|
||||
artifacts:
|
||||
expose_as: 'front-build'
|
||||
paths:
|
||||
- public/
|
||||
allow_failure: false
|
||||
dependencies:
|
||||
- composer-build
|
||||
needs:
|
||||
- job: composer-build
|
||||
optional: true
|
||||
rules:
|
||||
- if: $CI_COMMIT_TAG != null && $APP_ENV != null
|
||||
|
||||
.docker-build:
|
||||
stage: build
|
||||
image:
|
||||
name: gcr.io/kaniko-project/executor:v1.9.1-debug
|
||||
entrypoint: [""]
|
||||
script:
|
||||
- /kaniko/executor
|
||||
--context "${CI_PROJECT_DIR}"
|
||||
--dockerfile "${CI_PROJECT_DIR}/Dockerfile"
|
||||
--destination "${IMAGE_TAG}"
|
||||
allow_failure: false
|
||||
dependencies:
|
||||
- npm-build
|
||||
- composer-build
|
||||
needs:
|
||||
- job: npm-build
|
||||
optional: true
|
||||
- job: composer-build
|
||||
optional: true
|
||||
|
||||
docker-build:staging:
|
||||
extends: .docker-build
|
||||
variables:
|
||||
IMAGE_TAG: "${CI_REGISTRY_IMAGE}:s-${APP_THEME_NAME}-${CI_PIPELINE_IID}"
|
||||
rules:
|
||||
- if: $CI_COMMIT_TAG != null && $APP_ENV == "staging"
|
||||
|
||||
|
||||
docker-build:production:
|
||||
extends: .docker-build
|
||||
variables:
|
||||
IMAGE_TAG: "${CI_REGISTRY_IMAGE}:p-${APP_THEME_NAME}-${CI_PIPELINE_IID}"
|
||||
rules:
|
||||
- if: $CI_COMMIT_TAG != null && $APP_ENV == "production"
|
||||
|
||||
|
||||
stages:
|
||||
- lint
|
||||
- security
|
||||
- build
|
||||
- test
|
||||
- deploy
|
||||
|
|
|
|||
5
Dockerfile
Normal file
5
Dockerfile
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
FROM registry.s-web.fr/ldc-web/projets/ldc-web-images-docker/ldcweb-production-8.2:latest
|
||||
COPY --chown=www-data:www-data . /app/srcs
|
||||
USER root
|
||||
RUN chmod -R 755 /app/srcs/storage
|
||||
USER www-data
|
||||
Loading…
Add table
Reference in a new issue