Skip to content

Commit

Permalink
Fix docker configuration
Browse files Browse the repository at this point in the history
- Upgrade php version to 7.2
- Use docker volume for the db instead of shared files.
- Simplify things for avoiding some errors (ssl, xdebug).
  • Loading branch information
mpont91 committed Jul 4, 2019
1 parent 4e08be7 commit 2e2142c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 94 deletions.
37 changes: 0 additions & 37 deletions .docker/flarepoint-nginx/nginx-dev.conf
Original file line number Diff line number Diff line change
Expand Up @@ -24,40 +24,3 @@ server {
include fastcgi_params;
}
}

server {
listen 443 ssl;
#ssl_certificate /etc/letsencrypt/live/flarepoint-crm.io/fullchain.pem;
#ssl_certificate_key /etc/letsencrypt/live/flarepoint-crm.io/privkey.pem;
#ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
#ssl_prefer_server_ciphers on;
#ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';

server_name localhost;
root /var/www/html/public;
index index.php;

# Gzip
gzip on;
gzip_types text/plain text/xml text/css application/javascript application/x-javascript image/svg+xml;
gzip_vary on;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";

location = /favicon.ico {
root /img;
}

location / {
try_files $uri $uri/ /index.php$is_args$args;
}

location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass fastcgi_backend;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
include fastcgi_params;
}
}
40 changes: 4 additions & 36 deletions .docker/flarepoint-php/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,41 +1,9 @@
FROM php:7.0-fpm
FROM php:7.2-fpm

MAINTAINER Saleh Saeed <saleh.saiid@gmail.com>
MAINTAINER Marc Pont <slayerbleast@gmail.com>

WORKDIR /tmp
RUN apt-get update && apt-get install -y git zlib1g-dev libfreetype6-dev libjpeg62-turbo-dev libmcrypt-dev libpng-dev

RUN usermod -u 1000 www-data

RUN docker-php-source extract \
&& apt-get -qq update && apt-get install -y \
git zlib1g-dev \
libfreetype6-dev \
libjpeg62-turbo-dev \
libmcrypt-dev \
libpng-dev \
&& docker-php-ext-install pdo pdo_mysql zip \
&& docker-php-ext-install -j$(nproc) iconv mcrypt \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install -j$(nproc) gd \
&& apt-get autoclean && apt-get autoremove && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
&& docker-php-source delete

# Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

# Xdebug
RUN pecl install -o -f xdebug-2.4.0

ADD .docker/flarepoint-php/php-xdebug.ini /usr/local/etc/php/conf.d/php-xdebug.ini
RUN docker-php-ext-enable xdebug

COPY . /var/www/html
WORKDIR /var/www/html

# Set permissions
RUN chmod 0777 ./bootstrap/cache -R
RUN chmod 0777 ./storage/* -R

# RUN cd /var/www/html && composer install -q --no-dev -o

CMD ["php-fpm"]
RUN docker-php-ext-install pdo pdo_mysql zip gd
6 changes: 0 additions & 6 deletions .docker/flarepoint-php/php-xdebug.ini

This file was deleted.

23 changes: 8 additions & 15 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
version: "2"
version: "3"

services:
php:
container_name: flarepoint-php
build:
context: .
dockerfile: .docker/flarepoint-php/Dockerfile
context: .docker
dockerfile: flarepoint-php/Dockerfile
volumes:
- .:/var/www/html
environment:
Expand All @@ -23,10 +23,9 @@ services:

db:
container_name: flarepoint-db
image: mysql:latest
image: mysql:5.7
volumes:
- .docker/flarepoint-db/mysql:/var/lib/mysql
- .docker/flarepoint-db/db/:/docker-entrypoint-initdb.d/
- mysql:/var/lib/mysql
ports:
- 3307:3306
restart: always
Expand All @@ -38,7 +37,7 @@ services:

nginx:
container_name: flarepoint-nginx
image: nginx:latest
image: nginx:1.17
links:
- php
ports:
Expand All @@ -47,11 +46,5 @@ services:
- .docker/flarepoint-nginx/nginx-dev.conf:/etc/nginx/conf.d/default.conf
- .:/var/www/html

networks:
default:
driver: bridge
ipam:
driver: default
config:
- subnet: 172.16.0.0/16
gateway: 172.16.0.1
volumes:
mysql:

0 comments on commit 2e2142c

Please sign in to comment.