-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(Docker): Improved docker files for a better and cleaner infr…
…astructure
- Loading branch information
José Postiga
committed
Nov 16, 2019
1 parent
574ddaf
commit 6f73c39
Showing
6 changed files
with
125 additions
and
121 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,82 +1,49 @@ | ||
version: '3' | ||
|
||
networks: | ||
akaunting: | ||
|
||
volumes: | ||
mysqldata: | ||
# pgsqldata: | ||
version: '3.7' | ||
|
||
services: | ||
nginx: | ||
image: nginx:stable-alpine | ||
container_name: nginx | ||
image: nginx | ||
ports: | ||
- "8080:80" | ||
- 8080:80 | ||
volumes: | ||
- ./nginx/conf.d:/etc/nginx/conf.d:ro | ||
- .:/var/www/akaunting.test | ||
restart: unless-stopped | ||
networks: | ||
akaunting: | ||
aliases: | ||
- akaunting.test | ||
|
||
app: | ||
build: ./php | ||
user: "1000:1000" | ||
expose: | ||
- 9000 | ||
volumes: | ||
- ./:/var/www/html | ||
- ./nginx.example.com.conf:/etc/nginx/conf.d/default.conf | ||
depends_on: | ||
- php | ||
- mysql | ||
- .:/var/www/akaunting.test | ||
restart: unless-stopped | ||
environment: | ||
APP_DEBUG: "true" | ||
networks: | ||
- akaunting | ||
|
||
mysql: | ||
image: mysql:5 | ||
container_name: mysql | ||
restart: unless-stopped | ||
volumes: | ||
- mysqldata:/var/lib/mysql | ||
tty: true | ||
ports: | ||
- "3306:3306" | ||
- 3306:3306 | ||
volumes: | ||
- db-data:/var/lib/mysql | ||
environment: | ||
MYSQL_ROOT_PASSWORD: akaunting_root_password | ||
MYSQL_DATABASE: akaunting_db | ||
MYSQL_USER: akaunting_admin | ||
MYSQL_PASSWORD: akaunting_password | ||
SERVICE_TAGS: dev | ||
SERVICE_NAME: mysql | ||
networks: | ||
- akaunting | ||
|
||
# pgsql: | ||
# image: postgres:9.6-alpine | ||
# volumes: | ||
# - pgsqldata:/var/lib/postgresql/data | ||
# environment: | ||
# - "POSTGRES_DB=akaunting_db" | ||
# - "POSTGRES_USER=akaunting_admin" | ||
# - "POSTGRES_PASSWORD=akaunting_password" | ||
# ports: | ||
# - "5432:5432" | ||
|
||
php: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
container_name: php | ||
volumes: | ||
- ./:/var/www/html | ||
ports: | ||
- "9000:9000" | ||
networks: | ||
- akaunting | ||
depends_on: | ||
- mysql | ||
|
||
command: --default-authentication-plugin=mysql_native_password | ||
|
||
# redis: | ||
# container_name: redis | ||
# image: redis:4.0-alpine | ||
# command: redis-server --appendonly yes | ||
# networks: | ||
# - akaunting | ||
# ports: | ||
# - "6379:6379" | ||
volumes: | ||
db-data: | ||
|
||
# elastic: | ||
# image: elasticsearch:5.5-alpine | ||
# ports: | ||
# - "9200:9200" | ||
networks: | ||
akaunting: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
server { | ||
server_name akaunting.test; | ||
listen 80 default_server; | ||
|
||
access_log /dev/stdout; | ||
error_log /dev/stdout; | ||
|
||
root /var/www/akaunting.test; | ||
index index.php index.html; | ||
|
||
add_header X-Frame-Options "SAMEORIGIN"; | ||
add_header X-XSS-Protection "1; mode=block"; | ||
add_header X-Content-Type-Options "nosniff"; | ||
|
||
charset utf-8; | ||
|
||
# Prevent Direct Access To Protected Files | ||
location ~ \.(env|log) { | ||
deny all; | ||
} | ||
|
||
# Prevent Direct Access To Protected Folders | ||
location ~ ^/(^app$|bootstrap|config|database|resources|routes|storage|tests|artisan) { | ||
deny all; | ||
} | ||
|
||
# Prevent Direct Access To modules/vendor Folders Except Assets | ||
location ~ ^/(modules|vendor)\/(.*)\.((?!ico|gif|jpg|jpeg|png|js|css|less|sass|font|woff|woff2|eot|ttf|svg).)*$ { | ||
deny all; | ||
} | ||
|
||
location / { | ||
try_files $uri $uri/ /index.php?$query_string; | ||
gzip_static on; | ||
} | ||
|
||
location ~ \.php$ { | ||
try_files $uri =404; | ||
fastcgi_split_path_info ^(.+\.php)(/.+)$; | ||
fastcgi_pass app:9000; | ||
fastcgi_index index.php; | ||
include fastcgi_params; | ||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | ||
fastcgi_param PATH_INFO $fastcgi_path_info; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
FROM php:7.2-fpm | ||
|
||
RUN apt-get update && apt-get install -y \ | ||
imagemagick \ | ||
libfreetype6-dev \ | ||
libjpeg62-turbo-dev \ | ||
libmcrypt-dev \ | ||
libpng-dev \ | ||
libpq-dev \ | ||
libxrender1 \ | ||
locales \ | ||
openssh-client \ | ||
patch \ | ||
unzip \ | ||
zlib1g-dev \ | ||
--no-install-recommends && \ | ||
apt-get clean && rm -rf /var/lib/apt/lists/* | ||
|
||
RUN cp /usr/share/i18n/SUPPORTED /etc/locale.gen | ||
RUN locale-gen | ||
|
||
RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ | ||
|
||
RUN docker-php-ext-install \ | ||
gd \ | ||
pcntl \ | ||
pdo_mysql \ | ||
zip | ||
|
||
RUN pecl channel-update pecl.php.net \ | ||
&& printf "\n" | pecl install mcrypt-1.0.2 \ | ||
&& printf "\n" | pecl install xdebug-2.7.2 \ | ||
&& docker-php-ext-enable mcrypt xdebug | ||
|
||
COPY conf/xdebug.ini /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini | ||
COPY conf/zz-docker.conf /usr/local/etc/php-fpm.d/zz-docker.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20170718/xdebug.so | ||
xdebug.remote_connect_back=1 | ||
xdebug.remote_enable=1 | ||
xdebug.remote_port=9000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[global] | ||
daemonize = no | ||
|
||
[www] | ||
listen = 9000 | ||
|
||
pm = dynamic | ||
pm.max_children = 64 | ||
pm.process_idle_timeout = 2s | ||
pm.max_requests = 1000 |