mirror of https://github.com/akaunting/docker.git
Merge pull request #1 from josepostiga/feature/better-docker-configuration
Improve current Docker files
This commit is contained in:
commit
964cc93a71
59
Dockerfile
59
Dockerfile
|
@ -1,59 +0,0 @@
|
|||
FROM php:7.3-fpm-alpine
|
||||
|
||||
RUN apk add --no-cache --virtual .build-deps \
|
||||
$PHPIZE_DEPS \
|
||||
curl-dev \
|
||||
imagemagick-dev \
|
||||
libtool \
|
||||
libxml2-dev \
|
||||
postgresql-dev \
|
||||
sqlite-dev \
|
||||
&& apk add --no-cache \
|
||||
curl \
|
||||
git \
|
||||
gd \
|
||||
imagemagick \
|
||||
mysql-client \
|
||||
postgresql-libs \
|
||||
libintl \
|
||||
icu \
|
||||
icu-dev \
|
||||
libzip-dev \
|
||||
&& pecl install imagick \
|
||||
&& docker-php-ext-enable imagick \
|
||||
&& apk add --no-cache freetype libpng libjpeg-turbo freetype-dev libpng-dev libjpeg-turbo-dev && \
|
||||
docker-php-ext-configure gd \
|
||||
--with-gd \
|
||||
--with-freetype-dir=/usr/include/ \
|
||||
--with-png-dir=/usr/include/ \
|
||||
--with-jpeg-dir=/usr/include/ && \
|
||||
NPROC=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1) && \
|
||||
docker-php-ext-install -j${NPROC} gd && \
|
||||
apk del --no-cache freetype-dev libpng-dev libjpeg-turbo-dev \
|
||||
&& docker-php-ext-install \
|
||||
bcmath \
|
||||
curl \
|
||||
iconv \
|
||||
mbstring \
|
||||
pdo \
|
||||
pdo_mysql \
|
||||
pdo_pgsql \
|
||||
pdo_sqlite \
|
||||
pcntl \
|
||||
tokenizer \
|
||||
xml \
|
||||
zip \
|
||||
intl \
|
||||
&& apk del -f .build-deps
|
||||
|
||||
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
||||
|
||||
ENV COMPOSER_ALLOW_SUPERUSER=1
|
||||
RUN composer global require hirak/prestissimo --prefer-dist --no-progress --no-suggest --classmap-authoritative \
|
||||
&& composer clear-cache
|
||||
ENV PATH="${PATH}:/root/.composer/vendor/bin"
|
||||
|
||||
WORKDIR /var/www/html
|
||||
RUN mkdir -p storage bootstrap/cache
|
||||
# Authorize these folders to be edited
|
||||
RUN chmod -R 777 storage bootstrap/cache
|
|
@ -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:
|
||||
- ./:/var/www/html
|
||||
- ./nginx.example.com.conf:/etc/nginx/conf.d/default.conf
|
||||
depends_on:
|
||||
- php
|
||||
- mysql
|
||||
- ./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/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
|
||||
command: --default-authentication-plugin=mysql_native_password
|
||||
|
||||
# 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"
|
||||
db-data:
|
||||
|
||||
networks:
|
||||
- akaunting
|
||||
depends_on:
|
||||
- mysql
|
||||
|
||||
|
||||
# redis:
|
||||
# container_name: redis
|
||||
# image: redis:4.0-alpine
|
||||
# command: redis-server --appendonly yes
|
||||
# networks:
|
||||
# - akaunting
|
||||
# ports:
|
||||
# - "6379:6379"
|
||||
|
||||
# elastic:
|
||||
# image: elasticsearch:5.5-alpine
|
||||
# ports:
|
||||
# - "9200:9200"
|
||||
akaunting:
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
Loading…
Reference in New Issue