Skip to content

Commit 340fa16

Browse files
committed
Initial Commit
0 parents  commit 340fa16

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+5977
-0
lines changed

.docker/apache/Dockerfile

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM debian:buster
2+
3+
RUN apt-get update && apt-get install -y --no-install-recommends software-properties-common apache2 curl openssl nano&& \
4+
rm -r /var/lib/apt/lists/* &&\
5+
a2enmod proxy_fcgi ssl rewrite proxy proxy_balancer proxy_http proxy_ajp deflate mime setenvif headers http2 && \
6+
rm -f /var/run/apache2/apache2.pid
7+
8+
COPY entrypoint.sh /entrypoint.sh
9+
RUN chmod 755 /entrypoint.sh
10+
11+
EXPOSE 80 443 44380
12+
CMD ["/entrypoint.sh"]

.docker/apache/entrypoint.sh

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/usr/bin/env bash
2+
apache2ctl -DFOREGROUND -e info

.docker/apache/include/include.conf

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
ServerName ${server_name}
2+
ServerAlias www.${server_name}
3+
4+
<FilesMatch \.php$>
5+
SetHandler "proxy:fcgi://php-fpm:9000"
6+
</FilesMatch>
7+
8+
DocumentRoot ${docRoot}
9+
10+
Alias /.well-known/ ${appRoot}/.well-known/
11+
<Directory "${appRoot}/.well-known/">
12+
Require all granted
13+
Options None
14+
AllowOverride None
15+
ForceType text/plain
16+
</Directory>
17+
18+
<Directory ${docRoot}>
19+
AllowOverride All
20+
Require all granted
21+
DirectoryIndex ${docRoot}/${indexPrefix}.php
22+
<IfModule mod_negotiation.c>
23+
Options -MultiViews
24+
</IfModule>
25+
26+
<IfModule mod_mime.c>
27+
AddType application/x-javascript .js
28+
AddType text/css .css
29+
</IfModule>
30+
<IfModule mod_deflate.c>
31+
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css application/xml application/xhtml+xml application/rss+xml application/json application/javascript application/x-javascript image/svg+xml
32+
<IfModule mod_setenvif.c>
33+
BrowserMatch ^Mozilla/4 gzip-only-text/html
34+
BrowserMatch ^Mozilla/4.0[678] no-gzip
35+
BrowserMatch bMSIE !no-gzip !gzip-only-text/html
36+
</IfModule>
37+
</IfModule>
38+
Header append Vary User-Agent env=!dont-vary
39+
40+
<IfModule mod_rewrite.c>
41+
RewriteEngine On
42+
43+
RewriteCond %{REQUEST_URI}::$0 ^(/.+)/(.*)::\2$
44+
RewriteRule .* - [E=BASE:%1]
45+
46+
RewriteCond %{HTTP:Authorization} .+
47+
RewriteRule ^ - [E=HTTP_AUTHORIZATION:%0]
48+
49+
RewriteCond %{ENV:REDIRECT_STATUS} =""
50+
RewriteRule ^${indexPrefix}\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L]
51+
52+
RewriteCond %{REQUEST_FILENAME} !-f
53+
RewriteRule ^ %{ENV:BASE}/${indexPrefix}.php [L]
54+
</IfModule>
55+
56+
<IfModule !mod_rewrite.c>
57+
<IfModule mod_alias.c>
58+
RedirectMatch 302 ^/$ /${indexPrefix}.php/
59+
</IfModule>
60+
</IfModule>
61+
</Directory>
62+
63+
<Directory ${appRoot}/var>
64+
<IfModule mod_authz_core.c>
65+
Require all denied
66+
</IfModule>
67+
<IfModule !mod_authz_core.c>
68+
Order deny,allow
69+
Deny from all
70+
</IfModule>
71+
</Directory>

.docker/apache/sites-enabled/web.conf

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
Define server_name web.local
2+
Define appRoot /var/www
3+
Define docRoot ${appRoot}/public
4+
Define indexPrefix index
5+
Define logdir /var/log/apache2/
6+
7+
ServerName localhost
8+
Listen 44380
9+
10+
ErrorLog ${logdir}/error.log
11+
CustomLog ${logdir}/access.log Combined
12+
13+
Protocols h2c http/1.1
14+
<VirtualHost *:80>
15+
#Should only be Exposed for Dev only
16+
Include /etc/apache2/include/include.conf
17+
</VirtualHost>
18+
19+
<VirtualHost *:443>
20+
SSLEngine on
21+
SSLCertificateFile /etc/http-certs/cert.crt
22+
SSLCertificateKeyFile /etc/http-certs/cert.key
23+
Protocols h2 http/1.1
24+
25+
Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains; preload"
26+
27+
Include /etc/apache2/include/include.conf
28+
</VirtualHost>
29+
30+
<VirtualHost *:44380>
31+
# Redirects port 80 to 443 should be used in Production
32+
ServerName ${server_name}
33+
ServerAlias www.${server_name} lb.${server_name}
34+
35+
<IfModule mod_rewrite.c>
36+
RewriteEngine On
37+
RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R=301,L]
38+
</IfModule>
39+
40+
<IfModule !mod_rewrite.c>
41+
<IfModule mod_alias.c>
42+
RedirectMatch 301 "^/?(.*)" "https://${server_name}/$1"
43+
</IfModule>
44+
</IfModule>
45+
</VirtualHost>
46+
47+
SSLProtocol all -SSLv3 -TLSv1 -TLSv1.1
48+
SSLCipherSuite ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384
49+
SSLHonorCipherOrder off
50+
SSLSessionTickets off
51+
52+
#SSLUseStapling On
53+
#SSLStaplingCache "shmcb:logs/ssl_stapling(32768)"
54+
55+
SSLOpenSSLConfCmd Curves secp384r1
56+
SSLOpenSSLConfCmd DHParameters "/etc/http-certs/dhparam.pem"
57+
58+
Undefine server_name
59+
Undefine appRoot
60+
Undefine docRoot
61+
Undefine logdir

.docker/certs/dhparam.pem

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
-----BEGIN DH PARAMETERS-----
2+
MIIBCAKCAQEA//////////+t+FRYortKmq/cViAnPTzx2LnFg84tNpWp4TZBFGQz
3+
+8yTnc4kmz75fS/jY2MMddj2gbICrsRhetPfHtXV/WVhJDP1H18GbtCFY2VVPe0a
4+
87VXE15/V8k1mE8McODmi3fipona8+/och3xWKE2rec1MKzKT0g6eXq8CrGCsyT7
5+
YdEIqUuyyOP7uWrat2DX9GgdT0Kj3jlN9K5W7edjcrsZCwenyO4KbXCeAvzhzffi
6+
7MA0BM0oNC9hkXL+nOmFg/+OTxIy7vKBg8P+OxtMb61zO7X8vC7CIAXFjvGDfRaD
7+
ssbzSibBsu/6iGtCOGEoXJf//////////wIBAg==
8+
-----END DH PARAMETERS-----

.docker/nginx/conf.d/web.conf

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
server {
2+
listen 44380;
3+
listen [::]:44380;
4+
server_name _;
5+
return 301 https://$host$request_uri;
6+
}
7+
8+
server {
9+
set $serverName web.local;
10+
set $appRoot /var/www;
11+
set $docRoot $appRoot/public;
12+
set $indexPrefix index;
13+
14+
listen 80;
15+
listen [::]:80;
16+
listen 443 ssl http2;
17+
listen [::]:443 ssl http2;
18+
19+
ssl_certificate /etc/http-certs/cert.crt;
20+
ssl_certificate_key /etc/http-certs/cert.key;
21+
ssl_dhparam /etc/http-certs/dhparam.pem;
22+
ssl_session_timeout 1d;
23+
ssl_session_cache shared:MozSSL:10m;
24+
ssl_session_tickets off;
25+
ssl_protocols TLSv1.2 TLSv1.3;
26+
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
27+
ssl_prefer_server_ciphers on;
28+
ssl_stapling on;
29+
ssl_stapling_verify on;
30+
31+
server_name $serverName;
32+
root $docRoot;
33+
34+
gzip on;
35+
gzip_vary on;
36+
gzip_proxied any;
37+
gzip_types text/plain text/css application/xml application/xhtml+xml application/rss+xml application/json application/javascript application/x-javascript image/svg+xml;
38+
39+
location / {
40+
try_files $uri /$indexPrefix.php$is_args$args;
41+
}
42+
43+
location ^~ /.well-known/ {
44+
allow all;
45+
}
46+
47+
location ~* \.(jpg|jpeg|png|gif|ico)$ {
48+
log_not_found off;
49+
access_log off;
50+
}
51+
52+
location ~ \.php(/|$) {
53+
fastcgi_pass php-fpm:9000;
54+
fastcgi_split_path_info ^(.+\.php)(/.*)$;
55+
fastcgi_index $indexPrefix.php;
56+
include fastcgi_params;
57+
58+
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
59+
fastcgi_param DOCUMENT_ROOT $realpath_root;
60+
61+
fastcgi_buffers 8 16k;
62+
fastcgi_buffer_size 32k;
63+
fastcgi_read_timeout 240;
64+
proxy_connect_timeout 10;
65+
proxy_send_timeout 300;
66+
proxy_read_timeout 300;
67+
}
68+
69+
# return 404 for all other php files not matching the front controller
70+
# this prevents access to other php files you don't want to be accessible.
71+
location ~ \.php$ {
72+
return 404;
73+
}
74+
75+
error_log /var/log/nginx/error.log;
76+
access_log /var/log/nginx/access.log;
77+
}

.docker/php/cli/Dockerfile

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
FROM php:7.4-cli-buster
2+
3+
COPY php.ini /usr/local/etc/php/php.ini
4+
COPY xdebug.ini /xdebug.ini
5+
6+
RUN apt-get update && \
7+
pecl install xdebug && \
8+
apt-get install -y --no-install-recommends \
9+
acl apt-transport-https apt-utils \
10+
build-essential curl debconf \
11+
git gnupg gnupg1 gnupg2 \
12+
libjpeg-dev libldb-dev libldap2-dev libonig-dev libpq-dev libpng-dev libssl-dev libxml2 libxml2-dev libxpm-dev libzip-dev libzip4 locales\
13+
mailutils nano openssl rsync sudo unzip wget zip zlib1g-dev && \
14+
apt-get autoremove && apt-get clean && rm -rf /var/lib/apt/lists/* && echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && locale-gen && \
15+
docker-php-ext-install bcmath exif gd intl ldap opcache pdo_mysql pdo_pgsql sockets zip
16+
17+
COPY entrypoint.sh /entrypoint.sh
18+
RUN chmod 755 /entrypoint.sh
19+
20+
WORKDIR /var/www
21+
22+
RUN curl -sSk https://getcomposer.org/installer | php -- --disable-tls && mv composer.phar /usr/local/bin/composer &&\
23+
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - &&\
24+
curl -sL https://deb.nodesource.com/setup_14.x | bash - &&\
25+
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list &&\
26+
apt-get update && apt-get install -y --no-install-recommends --no-install-suggests supervisor nodejs yarn
27+
28+
COPY supervisor.conf /etc/supervisor/conf.d/supervisor.conf
29+
CMD ["/entrypoint.sh"]

.docker/php/cli/entrypoint.sh

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env bash
2+
APP_ENV=${APP_ENV:-prod}
3+
4+
source ~/.bashrc
5+
if [[ ! "dev" == "$APP_ENV" ]]; then
6+
if [[ -e /usr/local/etc/php/conf.d/xdebug.ini ]]; then
7+
rm -f /usr/local/etc/php/conf.d/xdebug.ini
8+
fi
9+
else
10+
ln -s /xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini
11+
fi
12+
touch /var/log/supervisor/supervisord.log
13+
/usr/bin/supervisord

0 commit comments

Comments
 (0)