Add docker setup

This commit is contained in:
Kacper Donat 2020-04-10 21:54:49 +02:00
parent 6b4cb466b7
commit 29ff2da6e4
6 changed files with 78 additions and 1 deletions

18
docker-compose.yml Normal file
View File

@ -0,0 +1,18 @@
version: '3.4'
services:
nginx:
image: nginx:latest
ports:
- "8080:80"
volumes:
- ./:/var/www:cached
- ./docker/nginx/keylighter.localhost:/etc/nginx/conf.d/keylighter.conf
php:
build: docker/php
env_file:
- ./docker/php/.env
volumes:
- ./:/var/www:cached
- ./docker/php/log.conf:/usr/local/etc/php-fpm.d/zz-log.conf

View File

@ -0,0 +1,28 @@
server {
root /var/www/public/;
server_name keylighter.localhost;
index index.php;
location / {
try_files $uri $uri/ /index.php?$args;
location ~ \.(js|css)$ {
expires 1y;
}
location ~ ^/index\.php(/|$) {
fastcgi_pass php:9000;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
fastcgi_param APP_ENV "dev";
fastcgi_param DATABASE_URL "sqlite:///%kernel.project_dir%/var/app.db";
internal;
}
}
}

1
docker/php/.env Normal file
View File

@ -0,0 +1 @@
PHP_IDE_CONFIG=serverName=keylighter

28
docker/php/Dockerfile Normal file
View File

@ -0,0 +1,28 @@
FROM php:7.3-fpm
ARG XDEBUG_REMOTE_HOST="172.17.0.1"
RUN apt-get update && \
apt-get install -y --no-install-recommends git zip libzip-dev
RUN docker-php-ext-install zip
# XDebug
RUN pecl install xdebug-2.9.0 && docker-php-ext-enable xdebug
RUN echo "xdebug.remote_enable = 1" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini && \
echo "xdebug.remote_host = ${XDEBUG_REMOTE_HOST}" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini;
#Composer
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
&& php composer-setup.php \
&& php -r "unlink('composer-setup.php');" \
&& mv composer.phar /usr/local/bin/composer \
&& chmod +x /usr/local/bin/composer
# Timezone
RUN ln -snf /usr/share/zoneinfo/Europe/Warsaw /etc/localtime
RUN echo "date.timezone = Europe/Warsaw" >> /usr/local/etc/php/conf.d/datetime.ini;
WORKDIR /var/www
EXPOSE 9001

2
docker/php/log.conf Normal file
View File

@ -0,0 +1,2 @@
php_admin_flag[log_errors] = on
php_flag[display_errors] = off

View File

@ -1,6 +1,6 @@
{
"php": {
"version": "7.4"
"version": "7.3"
},
"psr/cache": {
"version": "1.0.1"