add development and production targets; run phpunit in container
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Lexi / Zoe 2020-06-28 18:07:30 +02:00
parent 2a0af653cb
commit 9095a604a2
Signed by: binaryDiv
GPG Key ID: F8D4956E224DA232
5 changed files with 23 additions and 8 deletions

View File

@ -29,13 +29,13 @@ steps:
commands:
- composer install --no-progress --no-interaction --no-dev --optimize-autoloader
- name: build image
- name: build production image
image: docker
volumes:
- name: dockersock
path: /var/run/docker.sock
commands:
- docker build -t notecat:latest .
- docker build --target production -t notecat:latest .
- name: deploy on testing
image: docker/compose

View File

@ -1,9 +1,20 @@
FROM php:7.4-apache
FROM php:7.4-apache AS base
WORKDIR /var/www
RUN sed -ri -e 's!/var/www/html!/var/www/public!g' /etc/apache2/sites-available/*.conf
FROM base AS development
RUN cp $PHP_INI_DIR/php.ini-development $PHP_INI_DIR/php.ini
RUN pecl install xdebug && docker-php-ext-enable xdebug
FROM base AS production
RUN cp $PHP_INI_DIR/php.ini-production $PHP_INI_DIR/php.ini
COPY vendor/ /var/www/vendor/
COPY public/ /var/www/public/
COPY src/ /var/www/src/

View File

@ -29,7 +29,7 @@ install:
test: phpunit
phpunit:
${PHPUNIT} -c phpunit.xml
${DOCKER_COMPOSE_CMD} run web ${PHPUNIT} -c phpunit.xml
open_coverage:
${BROWSER} coverage/index.html

View File

@ -1,8 +1,10 @@
version: '3'
version: '3.4'
services:
web:
build: ..
build:
context: ..
target: development
restart: always
ports:
- 8080:80

View File

@ -1,8 +1,10 @@
version: '3'
version: '3.4'
services:
web:
build: ..
build:
context: ..
target: production
restart: always
networks:
- traefik