Skip to content
Snippets Groups Projects
Verified Commit 959dbc8a authored by Romain Lebbadi-Breteau's avatar Romain Lebbadi-Breteau
Browse files

Add gitlab cicd

parent e4fa276c
No related branches found
No related tags found
No related merge requests found
Checking pipeline status
variables:
DOCKER_HOST: tcp://dockerhost:2375/
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ''
stages:
- lint
- test
- build
lint:
stage: lint
image: php:8.1-cli
before_script:
- apt-get update -y && apt-get install -y git zip unzip libzip-dev
- docker-php-ext-install zip
- curl -sS https://getcomposer.org/installer | php
- php composer.phar install
script:
- php bin/console lint:yaml config
- php bin/console lint:container
- php vendor/bin/phplint --exclude=vendor --exclude=var --no-cache -v
include:
- template: Security/SAST.gitlab-ci.yml
build_image:
image: docker
services:
- name: docker:dind
alias: dockerhost
stage: build
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
script:
- docker build -t $CI_REGISTRY_IMAGE:$CI_COMMIT_BRANCH -f docker/Dockerfile.prod .
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_BRANCH
only:
- main
FROM php:8.1-fpm-alpine
COPY docker/wait-for-it.sh /usr/local/bin/wait-for-it
RUN chmod +x /usr/local/bin/wait-for-it && apk add --no-cache bash
ENV APP_ENV=prod
WORKDIR /var/www/html
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
RUN chmod +x /usr/local/bin/install-php-extensions && sync && install-php-extensions \
apcu \
intl \
opcache \
openssl \
pdo_pgsql \
zip
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
COPY --from=composer /usr/bin/composer /usr/bin/composer
RUN apk add --no-cache nginx
COPY docker/nginx.conf docker/calendar.conf /etc/nginx/
COPY --chown=root:root . .
RUN composer install --prefer-dist --no-dev --optimize-autoloader
CMD php bin/console cache:clear && wait-for-it database:5432 -- bin/console doctrine:migrations:migrate -n && nginx && php-fpm
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment