First version of monica image
This commit is contained in:
parent
3e927cedc3
commit
941d92e8da
127
.examples/nginx-proxy-self-signed-ssl/docker-compose.yml
Normal file
127
.examples/nginx-proxy-self-signed-ssl/docker-compose.yml
Normal file
@ -0,0 +1,127 @@
|
||||
# Run Monica with a self-signed-ssl certificate
|
||||
#
|
||||
# You might want to set these variables in you .env file:
|
||||
#
|
||||
#- APP_ENV=production
|
||||
#- APP_URL with your domain (https scheme)
|
||||
#- APP_TRUSTED_PROXIES=*
|
||||
#
|
||||
#- DB_HOST=db
|
||||
# See `db` container for these values:
|
||||
#- DB_DATABASE=monica
|
||||
#- DB_USERNAME=homestead
|
||||
#- DB_PASSWORD=secret
|
||||
#
|
||||
# To use redis:
|
||||
#- REDIS_HOST=redis
|
||||
#- CACHE_DRIVER=redis
|
||||
#- QUEUE_DRIVER=redis
|
||||
#
|
||||
|
||||
version: "3.4"
|
||||
|
||||
services:
|
||||
app:
|
||||
image: monica:fpm
|
||||
env_file: .env
|
||||
volumes:
|
||||
- data:/var/www/html/storage
|
||||
- www:/var/www/html
|
||||
restart: always
|
||||
depends_on:
|
||||
- db
|
||||
- redis
|
||||
|
||||
db:
|
||||
image: mysql:5.7
|
||||
environment:
|
||||
- MYSQL_ROOT_PASSWORD=sekret_root_password
|
||||
- MYSQL_DATABASE=monica
|
||||
- MYSQL_USER=homestead
|
||||
- MYSQL_PASSWORD=secret
|
||||
volumes:
|
||||
- db:/var/lib/mysql
|
||||
restart: always
|
||||
|
||||
redis:
|
||||
image: redis:alpine
|
||||
restart: always
|
||||
|
||||
cron:
|
||||
image: monica:fpm
|
||||
env_file: .env
|
||||
restart: always
|
||||
volumes:
|
||||
- data:/var/www/html/storage
|
||||
- www:/var/www/html:ro
|
||||
command: cron.sh
|
||||
depends_on:
|
||||
- db
|
||||
- redis
|
||||
|
||||
queue:
|
||||
image: monica:fpm
|
||||
env_file: .env
|
||||
restart: always
|
||||
volumes:
|
||||
- data:/var/www/html/storage
|
||||
- www:/var/www/html:ro
|
||||
command: queue.sh
|
||||
depends_on:
|
||||
- db
|
||||
- redis
|
||||
|
||||
web:
|
||||
build: ./web
|
||||
restart: always
|
||||
environment:
|
||||
- VIRTUAL_HOST=monica.local
|
||||
volumes:
|
||||
- data:/var/www/html/storage:ro
|
||||
- www:/var/www/html:ro
|
||||
depends_on:
|
||||
- app
|
||||
networks:
|
||||
- proxy-tier
|
||||
- default
|
||||
|
||||
proxy:
|
||||
build: ./proxy
|
||||
restart: always
|
||||
ports:
|
||||
- 80:80
|
||||
- 443:443
|
||||
volumes:
|
||||
- certs:/etc/nginx/certs:ro
|
||||
- /var/run/docker.sock:/tmp/docker.sock:ro
|
||||
networks:
|
||||
- proxy-tier
|
||||
depends_on:
|
||||
- omgwtfssl
|
||||
|
||||
omgwtfssl:
|
||||
image: paulczar/omgwtfssl
|
||||
restart: "no"
|
||||
volumes:
|
||||
- certs:/certs
|
||||
environment:
|
||||
- SSL_SUBJECT=monica.local
|
||||
- CA_SUBJECT=my@example.com
|
||||
- SSL_KEY=/certs/monica.local.key
|
||||
- SSL_CSR=/certs/monica.local.csr
|
||||
- SSL_CERT=/certs/monica.local.crt
|
||||
networks:
|
||||
- proxy-tier
|
||||
|
||||
volumes:
|
||||
data:
|
||||
name: data
|
||||
www:
|
||||
name: www
|
||||
db:
|
||||
name: db
|
||||
certs:
|
||||
name: certs
|
||||
|
||||
networks:
|
||||
proxy-tier:
|
||||
3
.examples/nginx-proxy-self-signed-ssl/proxy/Dockerfile
Normal file
3
.examples/nginx-proxy-self-signed-ssl/proxy/Dockerfile
Normal file
@ -0,0 +1,3 @@
|
||||
FROM jwilder/nginx-proxy:alpine
|
||||
|
||||
COPY vhost.conf /etc/nginx/vhost.d/default
|
||||
2
.examples/nginx-proxy-self-signed-ssl/proxy/vhost.conf
Normal file
2
.examples/nginx-proxy-self-signed-ssl/proxy/vhost.conf
Normal file
@ -0,0 +1,2 @@
|
||||
client_max_body_size 10G;
|
||||
server_tokens off;
|
||||
3
.examples/nginx-proxy-self-signed-ssl/web/Dockerfile
Normal file
3
.examples/nginx-proxy-self-signed-ssl/web/Dockerfile
Normal file
@ -0,0 +1,3 @@
|
||||
FROM nginx:alpine
|
||||
|
||||
COPY nginx.conf /etc/nginx/nginx.conf
|
||||
131
.examples/nginx-proxy-self-signed-ssl/web/nginx.conf
Normal file
131
.examples/nginx-proxy-self-signed-ssl/web/nginx.conf
Normal file
@ -0,0 +1,131 @@
|
||||
worker_processes 1;
|
||||
|
||||
error_log /var/log/nginx/error.log warn;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
|
||||
access_log /var/log/nginx/access.log main;
|
||||
|
||||
sendfile on;
|
||||
#tcp_nopush on;
|
||||
|
||||
keepalive_timeout 65;
|
||||
|
||||
set_real_ip_from 10.0.0.0/8;
|
||||
set_real_ip_from 172.16.0.0/12;
|
||||
set_real_ip_from 192.168.0.0/16;
|
||||
real_ip_header X-Real-IP;
|
||||
|
||||
#gzip on;
|
||||
|
||||
upstream php-handler {
|
||||
server app:9000;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
|
||||
server_name monica;
|
||||
|
||||
add_header X-Frame-Options "SAMEORIGIN";
|
||||
add_header X-Content-Type-Options nosniff;
|
||||
add_header X-XSS-Protection "1; mode=block";
|
||||
add_header X-Robots-Tag none;
|
||||
add_header X-Download-Options noopen;
|
||||
add_header X-Permitted-Cross-Domain-Policies none;
|
||||
add_header Referrer-Policy no-referrer;
|
||||
|
||||
root /var/www/html/public;
|
||||
|
||||
index index.html index.htm index.php;
|
||||
|
||||
charset utf-8;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.php?$query_string;
|
||||
}
|
||||
|
||||
location ~ ^/(?:robots.txt|security.txt) {
|
||||
allow all;
|
||||
log_not_found off;
|
||||
access_log off;
|
||||
}
|
||||
|
||||
error_page 404 500 502 503 504 /index.php;
|
||||
|
||||
location = /.well-known/(?:carddav|caldav) {
|
||||
return 301 $scheme://$host/dav;
|
||||
}
|
||||
location = /.well-known/security.txt {
|
||||
return 301 $scheme://$host/security.txt;
|
||||
}
|
||||
location ~ /\.(?!well-known).* {
|
||||
deny all;
|
||||
}
|
||||
|
||||
# set max upload size
|
||||
client_max_body_size 10G;
|
||||
fastcgi_buffers 64 4K;
|
||||
|
||||
# Enable gzip but do not remove ETag headers
|
||||
gzip on;
|
||||
gzip_vary on;
|
||||
gzip_comp_level 4;
|
||||
gzip_min_length 256;
|
||||
gzip_proxied expired no-cache no-store private no_last_modified no_etag auth;
|
||||
gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy;
|
||||
|
||||
# Uncomment if your server is build with the ngx_pagespeed module
|
||||
# This module is currently not supported.
|
||||
#pagespeed off;
|
||||
|
||||
location ~ \.php$ {
|
||||
# regex to split $uri to $fastcgi_script_name and $fastcgi_path
|
||||
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
||||
|
||||
# Check that the PHP script exists before passing it
|
||||
try_files $fastcgi_script_name =404;
|
||||
|
||||
fastcgi_pass php-handler;
|
||||
fastcgi_index index.php;
|
||||
|
||||
include fastcgi_params;
|
||||
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
# Bypass the fact that try_files resets $fastcgi_path_info
|
||||
# see: http://trac.nginx.org/nginx/ticket/321
|
||||
set $path_info $fastcgi_path_info;
|
||||
fastcgi_param PATH_INFO $path_info;
|
||||
}
|
||||
|
||||
# Adding the cache control header for js and css files
|
||||
# Make sure it is BELOW the PHP block
|
||||
location ~ \.(?:css|js|woff2?|svg|gif|json)$ {
|
||||
try_files $uri /index.php$request_uri;
|
||||
add_header Cache-Control "public, max-age=15778463";
|
||||
|
||||
# Optional: Don't log access to assets
|
||||
access_log off;
|
||||
}
|
||||
|
||||
location ~ \.(?:png|html|ttf|ico|jpg|jpeg)$ {
|
||||
try_files $uri /index.php$request_uri;
|
||||
|
||||
# Optional: Don't log access to assets
|
||||
access_log off;
|
||||
}
|
||||
}
|
||||
}
|
||||
133
.examples/nginx-proxy/docker-compose.yml
Normal file
133
.examples/nginx-proxy/docker-compose.yml
Normal file
@ -0,0 +1,133 @@
|
||||
# Run Monica with Let's Encrypt certificate
|
||||
#
|
||||
# You might want to set these variables in you .env file:
|
||||
#
|
||||
#- APP_ENV=production
|
||||
#- APP_URL with your domain (https scheme)
|
||||
#
|
||||
#- DB_HOST=db
|
||||
# See `db` container for these values:
|
||||
#- DB_DATABASE=monica
|
||||
#- DB_USERNAME=homestead
|
||||
#- DB_PASSWORD=secret
|
||||
#
|
||||
# To use redis:
|
||||
#- REDIS_HOST=redis
|
||||
#- CACHE_DRIVER=redis
|
||||
#- QUEUE_CONNECTION=redis
|
||||
#
|
||||
|
||||
version: "3.4"
|
||||
|
||||
services:
|
||||
app:
|
||||
image: monica:fpm
|
||||
env_file: .env
|
||||
volumes:
|
||||
- data:/var/www/html/storage
|
||||
- www:/var/www/html
|
||||
restart: always
|
||||
depends_on:
|
||||
- db
|
||||
- redis
|
||||
|
||||
db:
|
||||
image: mysql:5.7
|
||||
environment:
|
||||
- MYSQL_ROOT_PASSWORD=sekret_root_password
|
||||
- MYSQL_DATABASE=monica
|
||||
- MYSQL_USER=homestead
|
||||
- MYSQL_PASSWORD=secret
|
||||
volumes:
|
||||
- mysql:/var/lib/mysql
|
||||
restart: always
|
||||
|
||||
redis:
|
||||
image: redis:alpine
|
||||
restart: always
|
||||
|
||||
cron:
|
||||
image: monica:fpm
|
||||
env_file: .env
|
||||
restart: always
|
||||
volumes:
|
||||
- data:/var/www/html/storage
|
||||
- www:/var/www/html:ro
|
||||
command: cron.sh
|
||||
depends_on:
|
||||
- db
|
||||
- redis
|
||||
|
||||
queue:
|
||||
image: monica:fpm
|
||||
env_file: .env
|
||||
restart: always
|
||||
volumes:
|
||||
- data:/var/www/html/storage
|
||||
- www:/var/www/html:ro
|
||||
command: queue.sh
|
||||
depends_on:
|
||||
- db
|
||||
- redis
|
||||
|
||||
web:
|
||||
build: ./web
|
||||
restart: always
|
||||
environment:
|
||||
- VIRTUAL_HOST=
|
||||
- LETSENCRYPT_HOST=
|
||||
- LETSENCRYPT_EMAIL=
|
||||
volumes:
|
||||
- data:/var/www/html/storage:ro
|
||||
- www:/var/www/html:ro
|
||||
depends_on:
|
||||
- app
|
||||
networks:
|
||||
- proxy-tier
|
||||
- default
|
||||
|
||||
proxy:
|
||||
build: ./proxy
|
||||
restart: always
|
||||
ports:
|
||||
- 80:80
|
||||
- 443:443
|
||||
labels:
|
||||
com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy: "true"
|
||||
volumes:
|
||||
- certs:/etc/nginx/certs:ro
|
||||
- vhost.d:/etc/nginx/vhost.d
|
||||
- html:/usr/share/nginx/html
|
||||
- /var/run/docker.sock:/tmp/docker.sock:ro
|
||||
networks:
|
||||
- proxy-tier
|
||||
|
||||
letsencrypt-companion:
|
||||
image: jrcs/letsencrypt-nginx-proxy-companion
|
||||
restart: always
|
||||
volumes:
|
||||
- certs:/etc/nginx/certs
|
||||
- vhost.d:/etc/nginx/vhost.d
|
||||
- html:/usr/share/nginx/html
|
||||
- /var/run/docker.sock:/var/run/docker.sock:ro
|
||||
networks:
|
||||
- proxy-tier
|
||||
depends_on:
|
||||
- proxy
|
||||
|
||||
volumes:
|
||||
data:
|
||||
name: data
|
||||
www:
|
||||
name: www
|
||||
mysql:
|
||||
name: mysql
|
||||
certs:
|
||||
name: certs
|
||||
vhost.d:
|
||||
name: vhost.d
|
||||
html:
|
||||
name: html
|
||||
|
||||
networks:
|
||||
proxy-tier:
|
||||
3
.examples/nginx-proxy/proxy/Dockerfile
Normal file
3
.examples/nginx-proxy/proxy/Dockerfile
Normal file
@ -0,0 +1,3 @@
|
||||
FROM jwilder/nginx-proxy:alpine
|
||||
|
||||
COPY vhost.conf /etc/nginx/vhost.d/default
|
||||
2
.examples/nginx-proxy/proxy/vhost.conf
Normal file
2
.examples/nginx-proxy/proxy/vhost.conf
Normal file
@ -0,0 +1,2 @@
|
||||
client_max_body_size 10G;
|
||||
server_tokens off;
|
||||
3
.examples/nginx-proxy/web/Dockerfile
Normal file
3
.examples/nginx-proxy/web/Dockerfile
Normal file
@ -0,0 +1,3 @@
|
||||
FROM nginx:alpine
|
||||
|
||||
COPY nginx.conf /etc/nginx/nginx.conf
|
||||
131
.examples/nginx-proxy/web/nginx.conf
Normal file
131
.examples/nginx-proxy/web/nginx.conf
Normal file
@ -0,0 +1,131 @@
|
||||
worker_processes 1;
|
||||
|
||||
error_log /var/log/nginx/error.log warn;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
|
||||
access_log /var/log/nginx/access.log main;
|
||||
|
||||
sendfile on;
|
||||
#tcp_nopush on;
|
||||
|
||||
keepalive_timeout 65;
|
||||
|
||||
set_real_ip_from 10.0.0.0/8;
|
||||
set_real_ip_from 172.16.0.0/12;
|
||||
set_real_ip_from 192.168.0.0/16;
|
||||
real_ip_header X-Real-IP;
|
||||
|
||||
#gzip on;
|
||||
|
||||
upstream php-handler {
|
||||
server app:9000;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
|
||||
server_name monica;
|
||||
|
||||
add_header X-Frame-Options "SAMEORIGIN";
|
||||
add_header X-Content-Type-Options nosniff;
|
||||
add_header X-XSS-Protection "1; mode=block";
|
||||
add_header X-Robots-Tag none;
|
||||
add_header X-Download-Options noopen;
|
||||
add_header X-Permitted-Cross-Domain-Policies none;
|
||||
add_header Referrer-Policy no-referrer;
|
||||
|
||||
root /var/www/html/public;
|
||||
|
||||
index index.html index.htm index.php;
|
||||
|
||||
charset utf-8;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.php?$query_string;
|
||||
}
|
||||
|
||||
location ~ ^/(?:robots.txt|security.txt) {
|
||||
allow all;
|
||||
log_not_found off;
|
||||
access_log off;
|
||||
}
|
||||
|
||||
error_page 404 500 502 503 504 /index.php;
|
||||
|
||||
location = /.well-known/(?:carddav|caldav) {
|
||||
return 301 $scheme://$host/dav;
|
||||
}
|
||||
location = /.well-known/security.txt {
|
||||
return 301 $scheme://$host/security.txt;
|
||||
}
|
||||
location ~ /\.(?!well-known).* {
|
||||
deny all;
|
||||
}
|
||||
|
||||
# set max upload size
|
||||
client_max_body_size 10G;
|
||||
fastcgi_buffers 64 4K;
|
||||
|
||||
# Enable gzip but do not remove ETag headers
|
||||
gzip on;
|
||||
gzip_vary on;
|
||||
gzip_comp_level 4;
|
||||
gzip_min_length 256;
|
||||
gzip_proxied expired no-cache no-store private no_last_modified no_etag auth;
|
||||
gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy;
|
||||
|
||||
# Uncomment if your server is build with the ngx_pagespeed module
|
||||
# This module is currently not supported.
|
||||
#pagespeed off;
|
||||
|
||||
location ~ \.php$ {
|
||||
# regex to split $uri to $fastcgi_script_name and $fastcgi_path
|
||||
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
||||
|
||||
# Check that the PHP script exists before passing it
|
||||
try_files $fastcgi_script_name =404;
|
||||
|
||||
fastcgi_pass php-handler;
|
||||
fastcgi_index index.php;
|
||||
|
||||
include fastcgi_params;
|
||||
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
# Bypass the fact that try_files resets $fastcgi_path_info
|
||||
# see: http://trac.nginx.org/nginx/ticket/321
|
||||
set $path_info $fastcgi_path_info;
|
||||
fastcgi_param PATH_INFO $path_info;
|
||||
}
|
||||
|
||||
# Adding the cache control header for js and css files
|
||||
# Make sure it is BELOW the PHP block
|
||||
location ~ \.(?:css|js|woff2?|svg|gif|json)$ {
|
||||
try_files $uri /index.php$request_uri;
|
||||
add_header Cache-Control "public, max-age=15778463";
|
||||
|
||||
# Optional: Don't log access to assets
|
||||
access_log off;
|
||||
}
|
||||
|
||||
location ~ \.(?:png|html|ttf|ico|jpg|jpeg)$ {
|
||||
try_files $uri /index.php$request_uri;
|
||||
|
||||
# Optional: Don't log access to assets
|
||||
access_log off;
|
||||
}
|
||||
}
|
||||
}
|
||||
65
.examples/readme.md
Normal file
65
.examples/readme.md
Normal file
@ -0,0 +1,65 @@
|
||||
# Docker examples for Monica
|
||||
|
||||
In this section you will find some examples about how to use monica's docker images.
|
||||
|
||||
Example|Description
|
||||
-------|-----------
|
||||
[`supervisor`](supervisor)| uses supervisor to run a cron and a queue inside your container.
|
||||
[`nginx-proxy-self-signed-ssl`](nginx-proxy-self-signed-ssl)| shows you how to run monica with a self signed ssl certificate.
|
||||
[`nginx-proxy`](nginx-proxy)| shows you how to run monica with https and generate a [Let's Encrypt](https://letsencrypt.org/) certificate.
|
||||
|
||||
|
||||
## Run with docker-compose
|
||||
|
||||
### Configuration (all versions)
|
||||
|
||||
First, download a copy of Monica example configuration file:
|
||||
|
||||
```sh
|
||||
curl -sS https://raw.githubusercontent.com/monicahq/monica/master/.env.example -o .env
|
||||
```
|
||||
|
||||
Open the file in an editor and update it for your own needs:
|
||||
|
||||
- Set `APP_KEY` to a random 32-character string. For example, if you
|
||||
have the `pwgen` utility installed, you could copy and paste the
|
||||
output of `pwgen -s 32 1`.
|
||||
- Edit the `MAIL_*` settings to point to your own [mailserver](/docs/installation/mail.md).
|
||||
- Set `DB_*` settings to point to your database configuration. If you don't want to set a db prefix, be careful to set `DB_PREFIX=` and not `DB_PREFIX=''` as docker will not expand this as an empty string.
|
||||
- Set `DB_HOST=db` or any name of the database container you will link to.
|
||||
|
||||
|
||||
### With supervisor
|
||||
|
||||
The [`supervisor`](supervisor) examples shows you how to run monica with
|
||||
- a db container (mysql:5.7)
|
||||
- an app container, which run `supervisord` to handle a web server/fpm, a cron, and a queue.
|
||||
|
||||
This let you use `QUEUE_CONNECTION=database` in your `.env` file.
|
||||
|
||||
|
||||
### With nginx proxy and a self-signed certificate
|
||||
|
||||
[`nginx-proxy-self-signed-ssl`](nginx-proxy-self-signed-ssl) example shows you how to run monica with a self signed ssl certificate, to run the application in `https` mode.
|
||||
|
||||
Set `VIRTUAL_HOST` and `SSL_SUBJECT` with the right domain name, and update `SSL_KEY`, `SSL_CSR`, and `SSL_CERT` accordingly.
|
||||
This example generates a new self-signed certificate.
|
||||
|
||||
Your browser might warn you about security issue, as a self-signed certificate is not trusted in production mode. For a real domain certificate, see the next section.
|
||||
|
||||
|
||||
### With nginx proxy and a Let's Encrypt certificate
|
||||
|
||||
[`nginx-proxy`](nginx-proxy) example shows you how to run monica and generate a [Let's Encrypt](https://letsencrypt.org/) certificate for your domain.
|
||||
|
||||
Don't forget to set:
|
||||
- `VIRTUAL_HOST` and `LETSENCRYPT_HOST` with your domain
|
||||
- `LETSENCRYPT_EMAIL` with a valid email
|
||||
- `APP_URL` in your `.env` file with the right domain url
|
||||
|
||||
You may want to set `APP_ENV=production` to force the use of `https` mode.
|
||||
|
||||
This example add a `redis` container, that can be used too, adding these variables to your `.env` file:
|
||||
- `REDIS_HOST=redis`: mandatory
|
||||
- `CACHE_DRIVER=redis`: to use redis as a cache table
|
||||
- `QUEUE_CONNECTION=redis`: to use redis as a queue table
|
||||
13
.examples/supervisor/apache/app/Dockerfile
Normal file
13
.examples/supervisor/apache/app/Dockerfile
Normal file
@ -0,0 +1,13 @@
|
||||
FROM monica:apache
|
||||
|
||||
# supervisord dependencies
|
||||
RUN set -ex; \
|
||||
\
|
||||
apt-get update; \
|
||||
apt-get install -y --no-install-recommends \
|
||||
supervisor \
|
||||
; \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY supervisord.conf /etc/supervisord.conf
|
||||
CMD ["supervisord", "-c /etc/supervisord.conf"]
|
||||
30
.examples/supervisor/apache/app/supervisord.conf
Normal file
30
.examples/supervisor/apache/app/supervisord.conf
Normal file
@ -0,0 +1,30 @@
|
||||
[supervisord]
|
||||
nodaemon=true
|
||||
user=root
|
||||
|
||||
[program:cron]
|
||||
command=cron.sh
|
||||
autostart=true
|
||||
autorestart=true
|
||||
|
||||
[program:queue]
|
||||
process_name=%(program_name)s_%(process_num)02d
|
||||
command=queue.sh
|
||||
numprocs=1
|
||||
stdout_logfile=/proc/1/fd/1
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/proc/1/fd/2
|
||||
stderr_logfile_maxbytes=0
|
||||
autostart=true
|
||||
autorestart=true
|
||||
startretries=0
|
||||
|
||||
[program:httpd]
|
||||
process_name=%(program_name)s_%(process_num)02d
|
||||
command=entrypoint.sh apache2-foreground
|
||||
stdout_logfile=/proc/1/fd/1
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/proc/1/fd/2
|
||||
stderr_logfile_maxbytes=0
|
||||
autostart=true
|
||||
autorestart=true
|
||||
33
.examples/supervisor/apache/docker-compose.yml
Normal file
33
.examples/supervisor/apache/docker-compose.yml
Normal file
@ -0,0 +1,33 @@
|
||||
version: "3.4"
|
||||
|
||||
services:
|
||||
app:
|
||||
build: ./app
|
||||
depends_on:
|
||||
- db
|
||||
env_file: .env
|
||||
ports:
|
||||
- 80:80
|
||||
volumes:
|
||||
- data:/var/www/html/storage
|
||||
- www:/var/www/html
|
||||
restart: always
|
||||
|
||||
db:
|
||||
image: mysql:5.7
|
||||
environment:
|
||||
- MYSQL_ROOT_PASSWORD=sekret_root_password
|
||||
- MYSQL_DATABASE=monica
|
||||
- MYSQL_USER=homestead
|
||||
- MYSQL_PASSWORD=secret
|
||||
volumes:
|
||||
- mysql:/var/lib/mysql
|
||||
restart: always
|
||||
|
||||
volumes:
|
||||
data:
|
||||
name: data
|
||||
www:
|
||||
name: www
|
||||
mysql:
|
||||
name: mysql
|
||||
11
.examples/supervisor/fpm-alpine/app/Dockerfile
Normal file
11
.examples/supervisor/fpm-alpine/app/Dockerfile
Normal file
@ -0,0 +1,11 @@
|
||||
FROM monica:fpm-alpine
|
||||
|
||||
# supervisord dependencies
|
||||
RUN set -ex; \
|
||||
\
|
||||
apk add --no-cache \
|
||||
supervisor \
|
||||
;
|
||||
|
||||
COPY supervisord.conf /etc/supervisord.conf
|
||||
CMD ["supervisord", "-c /etc/supervisord.conf"]
|
||||
30
.examples/supervisor/fpm-alpine/app/supervisord.conf
Normal file
30
.examples/supervisor/fpm-alpine/app/supervisord.conf
Normal file
@ -0,0 +1,30 @@
|
||||
[supervisord]
|
||||
nodaemon=true
|
||||
user=root
|
||||
|
||||
[program:cron]
|
||||
command=cron.sh
|
||||
autostart=true
|
||||
autorestart=true
|
||||
|
||||
[program:queue]
|
||||
process_name=%(program_name)s_%(process_num)02d
|
||||
command=queue.sh
|
||||
numprocs=1
|
||||
stdout_logfile=/proc/1/fd/1
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/proc/1/fd/2
|
||||
stderr_logfile_maxbytes=0
|
||||
autostart=true
|
||||
autorestart=true
|
||||
startretries=0
|
||||
|
||||
[program:fpm]
|
||||
process_name=%(program_name)s_%(process_num)02d
|
||||
command=entrypoint.sh php-fpm
|
||||
stdout_logfile=/proc/1/fd/1
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/proc/1/fd/2
|
||||
stderr_logfile_maxbytes=0
|
||||
autostart=true
|
||||
autorestart=true
|
||||
42
.examples/supervisor/fpm-alpine/docker-compose.yml
Normal file
42
.examples/supervisor/fpm-alpine/docker-compose.yml
Normal file
@ -0,0 +1,42 @@
|
||||
version: "3.4"
|
||||
|
||||
services:
|
||||
app:
|
||||
build: ./app
|
||||
depends_on:
|
||||
- db
|
||||
env_file: .env
|
||||
volumes:
|
||||
- data:/var/www/html/storage
|
||||
- www:/var/www/html
|
||||
restart: always
|
||||
|
||||
web:
|
||||
build: ./web
|
||||
restart: always
|
||||
ports:
|
||||
- 80:80
|
||||
volumes:
|
||||
- data:/var/www/html/storage:ro
|
||||
- www:/var/www/html:ro
|
||||
depends_on:
|
||||
- app
|
||||
|
||||
db:
|
||||
image: mysql:5.7
|
||||
environment:
|
||||
- MYSQL_ROOT_PASSWORD=sekret_root_password
|
||||
- MYSQL_DATABASE=monica
|
||||
- MYSQL_USER=homestead
|
||||
- MYSQL_PASSWORD=secret
|
||||
volumes:
|
||||
- mysql:/var/lib/mysql
|
||||
restart: always
|
||||
|
||||
volumes:
|
||||
data:
|
||||
name: data
|
||||
www:
|
||||
name: www
|
||||
mysql:
|
||||
name: mysql
|
||||
3
.examples/supervisor/fpm-alpine/web/Dockerfile
Normal file
3
.examples/supervisor/fpm-alpine/web/Dockerfile
Normal file
@ -0,0 +1,3 @@
|
||||
FROM nginx:alpine
|
||||
|
||||
COPY nginx.conf /etc/nginx/nginx.conf
|
||||
126
.examples/supervisor/fpm-alpine/web/nginx.conf
Normal file
126
.examples/supervisor/fpm-alpine/web/nginx.conf
Normal file
@ -0,0 +1,126 @@
|
||||
worker_processes 1;
|
||||
|
||||
error_log /var/log/nginx/error.log warn;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
|
||||
access_log /var/log/nginx/access.log main;
|
||||
|
||||
sendfile on;
|
||||
#tcp_nopush on;
|
||||
|
||||
keepalive_timeout 65;
|
||||
|
||||
#gzip on;
|
||||
|
||||
upstream php-handler {
|
||||
server app:9000;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
|
||||
server_name monica;
|
||||
|
||||
add_header X-Frame-Options "SAMEORIGIN";
|
||||
add_header X-Content-Type-Options nosniff;
|
||||
add_header X-XSS-Protection "1; mode=block";
|
||||
add_header X-Robots-Tag none;
|
||||
add_header X-Download-Options noopen;
|
||||
add_header X-Permitted-Cross-Domain-Policies none;
|
||||
add_header Referrer-Policy no-referrer;
|
||||
|
||||
root /var/www/html/public;
|
||||
|
||||
index index.html index.htm index.php;
|
||||
|
||||
charset utf-8;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.php?$query_string;
|
||||
}
|
||||
|
||||
location ~ ^/(?:robots.txt|security.txt) {
|
||||
allow all;
|
||||
log_not_found off;
|
||||
access_log off;
|
||||
}
|
||||
|
||||
error_page 404 500 502 503 504 /index.php;
|
||||
|
||||
location = /.well-known/(?:carddav|caldav) {
|
||||
return 301 $scheme://$host/dav;
|
||||
}
|
||||
location = /.well-known/security.txt {
|
||||
return 301 $scheme://$host/security.txt;
|
||||
}
|
||||
location ~ /\.(?!well-known).* {
|
||||
deny all;
|
||||
}
|
||||
|
||||
# set max upload size
|
||||
client_max_body_size 10G;
|
||||
fastcgi_buffers 64 4K;
|
||||
|
||||
# Enable gzip but do not remove ETag headers
|
||||
gzip on;
|
||||
gzip_vary on;
|
||||
gzip_comp_level 4;
|
||||
gzip_min_length 256;
|
||||
gzip_proxied expired no-cache no-store private no_last_modified no_etag auth;
|
||||
gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy;
|
||||
|
||||
# Uncomment if your server is build with the ngx_pagespeed module
|
||||
# This module is currently not supported.
|
||||
#pagespeed off;
|
||||
|
||||
location ~ \.php$ {
|
||||
# regex to split $uri to $fastcgi_script_name and $fastcgi_path
|
||||
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
||||
|
||||
# Check that the PHP script exists before passing it
|
||||
try_files $fastcgi_script_name =404;
|
||||
|
||||
fastcgi_pass php-handler;
|
||||
fastcgi_index index.php;
|
||||
|
||||
include fastcgi_params;
|
||||
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
# Bypass the fact that try_files resets $fastcgi_path_info
|
||||
# see: http://trac.nginx.org/nginx/ticket/321
|
||||
set $path_info $fastcgi_path_info;
|
||||
fastcgi_param PATH_INFO $path_info;
|
||||
}
|
||||
|
||||
# Adding the cache control header for js and css files
|
||||
# Make sure it is BELOW the PHP block
|
||||
location ~ \.(?:css|js|woff2?|svg|gif|json)$ {
|
||||
try_files $uri /index.php$request_uri;
|
||||
add_header Cache-Control "public, max-age=15778463";
|
||||
|
||||
# Optional: Don't log access to assets
|
||||
access_log off;
|
||||
}
|
||||
|
||||
location ~ \.(?:png|html|ttf|ico|jpg|jpeg)$ {
|
||||
try_files $uri /index.php$request_uri;
|
||||
|
||||
# Optional: Don't log access to assets
|
||||
access_log off;
|
||||
}
|
||||
}
|
||||
}
|
||||
13
.examples/supervisor/fpm/app/Dockerfile
Normal file
13
.examples/supervisor/fpm/app/Dockerfile
Normal file
@ -0,0 +1,13 @@
|
||||
FROM monica:fpm
|
||||
|
||||
# supervisord dependencies
|
||||
RUN set -ex; \
|
||||
\
|
||||
apt-get update; \
|
||||
apt-get install -y --no-install-recommends \
|
||||
supervisor \
|
||||
; \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY supervisord.conf /etc/supervisord.conf
|
||||
CMD ["supervisord", "-c /etc/supervisord.conf"]
|
||||
30
.examples/supervisor/fpm/app/supervisord.conf
Normal file
30
.examples/supervisor/fpm/app/supervisord.conf
Normal file
@ -0,0 +1,30 @@
|
||||
[supervisord]
|
||||
nodaemon=true
|
||||
user=root
|
||||
|
||||
[program:cron]
|
||||
command=cron.sh
|
||||
autostart=true
|
||||
autorestart=true
|
||||
|
||||
[program:queue]
|
||||
process_name=%(program_name)s_%(process_num)02d
|
||||
command=queue.sh
|
||||
numprocs=1
|
||||
stdout_logfile=/proc/1/fd/1
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/proc/1/fd/2
|
||||
stderr_logfile_maxbytes=0
|
||||
autostart=true
|
||||
autorestart=true
|
||||
startretries=0
|
||||
|
||||
[program:fpm]
|
||||
process_name=%(program_name)s_%(process_num)02d
|
||||
command=entrypoint.sh php-fpm
|
||||
stdout_logfile=/proc/1/fd/1
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/proc/1/fd/2
|
||||
stderr_logfile_maxbytes=0
|
||||
autostart=true
|
||||
autorestart=true
|
||||
42
.examples/supervisor/fpm/docker-compose.yml
Normal file
42
.examples/supervisor/fpm/docker-compose.yml
Normal file
@ -0,0 +1,42 @@
|
||||
version: "3.4"
|
||||
|
||||
services:
|
||||
app:
|
||||
build: ./app
|
||||
depends_on:
|
||||
- db
|
||||
env_file: .env
|
||||
volumes:
|
||||
- data:/var/www/html/storage
|
||||
- www:/var/www/html
|
||||
restart: always
|
||||
|
||||
web:
|
||||
build: ./web
|
||||
restart: always
|
||||
ports:
|
||||
- 80:80
|
||||
volumes:
|
||||
- data:/var/www/html/storage:ro
|
||||
- www:/var/www/html:ro
|
||||
depends_on:
|
||||
- app
|
||||
|
||||
db:
|
||||
image: mysql:5.7
|
||||
environment:
|
||||
- MYSQL_ROOT_PASSWORD=sekret_root_password
|
||||
- MYSQL_DATABASE=monica
|
||||
- MYSQL_USER=homestead
|
||||
- MYSQL_PASSWORD=secret
|
||||
volumes:
|
||||
- mysql:/var/lib/mysql
|
||||
restart: always
|
||||
|
||||
volumes:
|
||||
data:
|
||||
name: data
|
||||
www:
|
||||
name: www
|
||||
mysql:
|
||||
name: mysql
|
||||
3
.examples/supervisor/fpm/web/Dockerfile
Normal file
3
.examples/supervisor/fpm/web/Dockerfile
Normal file
@ -0,0 +1,3 @@
|
||||
FROM nginx:alpine
|
||||
|
||||
COPY nginx.conf /etc/nginx/nginx.conf
|
||||
126
.examples/supervisor/fpm/web/nginx.conf
Normal file
126
.examples/supervisor/fpm/web/nginx.conf
Normal file
@ -0,0 +1,126 @@
|
||||
worker_processes 1;
|
||||
|
||||
error_log /var/log/nginx/error.log warn;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
|
||||
access_log /var/log/nginx/access.log main;
|
||||
|
||||
sendfile on;
|
||||
#tcp_nopush on;
|
||||
|
||||
keepalive_timeout 65;
|
||||
|
||||
#gzip on;
|
||||
|
||||
upstream php-handler {
|
||||
server app:9000;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
|
||||
server_name monica;
|
||||
|
||||
add_header X-Frame-Options "SAMEORIGIN";
|
||||
add_header X-Content-Type-Options nosniff;
|
||||
add_header X-XSS-Protection "1; mode=block";
|
||||
add_header X-Robots-Tag none;
|
||||
add_header X-Download-Options noopen;
|
||||
add_header X-Permitted-Cross-Domain-Policies none;
|
||||
add_header Referrer-Policy no-referrer;
|
||||
|
||||
root /var/www/html/public;
|
||||
|
||||
index index.html index.htm index.php;
|
||||
|
||||
charset utf-8;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.php?$query_string;
|
||||
}
|
||||
|
||||
location ~ ^/(?:robots.txt|security.txt) {
|
||||
allow all;
|
||||
log_not_found off;
|
||||
access_log off;
|
||||
}
|
||||
|
||||
error_page 404 500 502 503 504 /index.php;
|
||||
|
||||
location = /.well-known/(?:carddav|caldav) {
|
||||
return 301 $scheme://$host/dav;
|
||||
}
|
||||
location = /.well-known/security.txt {
|
||||
return 301 $scheme://$host/security.txt;
|
||||
}
|
||||
location ~ /\.(?!well-known).* {
|
||||
deny all;
|
||||
}
|
||||
|
||||
# set max upload size
|
||||
client_max_body_size 10G;
|
||||
fastcgi_buffers 64 4K;
|
||||
|
||||
# Enable gzip but do not remove ETag headers
|
||||
gzip on;
|
||||
gzip_vary on;
|
||||
gzip_comp_level 4;
|
||||
gzip_min_length 256;
|
||||
gzip_proxied expired no-cache no-store private no_last_modified no_etag auth;
|
||||
gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy;
|
||||
|
||||
# Uncomment if your server is build with the ngx_pagespeed module
|
||||
# This module is currently not supported.
|
||||
#pagespeed off;
|
||||
|
||||
location ~ \.php$ {
|
||||
# regex to split $uri to $fastcgi_script_name and $fastcgi_path
|
||||
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
||||
|
||||
# Check that the PHP script exists before passing it
|
||||
try_files $fastcgi_script_name =404;
|
||||
|
||||
fastcgi_pass php-handler;
|
||||
fastcgi_index index.php;
|
||||
|
||||
include fastcgi_params;
|
||||
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
# Bypass the fact that try_files resets $fastcgi_path_info
|
||||
# see: http://trac.nginx.org/nginx/ticket/321
|
||||
set $path_info $fastcgi_path_info;
|
||||
fastcgi_param PATH_INFO $path_info;
|
||||
}
|
||||
|
||||
# Adding the cache control header for js and css files
|
||||
# Make sure it is BELOW the PHP block
|
||||
location ~ \.(?:css|js|woff2?|svg|gif|json)$ {
|
||||
try_files $uri /index.php$request_uri;
|
||||
add_header Cache-Control "public, max-age=15778463";
|
||||
|
||||
# Optional: Don't log access to assets
|
||||
access_log off;
|
||||
}
|
||||
|
||||
location ~ \.(?:png|html|ttf|ico|jpg|jpeg)$ {
|
||||
try_files $uri /index.php$request_uri;
|
||||
|
||||
# Optional: Don't log access to assets
|
||||
access_log off;
|
||||
}
|
||||
}
|
||||
}
|
||||
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
* text=auto
|
||||
README.md export-ignore
|
||||
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
.env
|
||||
137
Dockerfile-alpine.template
Normal file
137
Dockerfile-alpine.template
Normal file
@ -0,0 +1,137 @@
|
||||
FROM php:%%PHP_VERSION%%-%%VARIANT%%
|
||||
|
||||
LABEL maintainer="Alexis Saettler <alexis@saettler.org>"
|
||||
|
||||
# entrypoint.sh dependencies
|
||||
RUN set -ex; \
|
||||
\
|
||||
apk add --no-cache \
|
||||
bash \
|
||||
coreutils \
|
||||
rsync \
|
||||
;
|
||||
|
||||
# Install required PHP extensions
|
||||
RUN set -ex; \
|
||||
\
|
||||
apk add --no-cache --virtual .build-deps \
|
||||
$PHPIZE_DEPS \
|
||||
icu-dev \
|
||||
zlib-dev \
|
||||
libzip-dev \
|
||||
libxml2-dev \
|
||||
freetype-dev \
|
||||
libpng-dev \
|
||||
libjpeg-turbo-dev \
|
||||
jpeg-dev \
|
||||
gmp-dev \
|
||||
libsodium-dev \
|
||||
libmemcached-dev \
|
||||
; \
|
||||
\
|
||||
docker-php-ext-configure intl; \
|
||||
docker-php-ext-configure gd \
|
||||
--with-gd \
|
||||
--with-freetype-dir=/usr/include/ \
|
||||
--with-jpeg-dir=/usr/include/ \
|
||||
--with-png-dir=/usr/include/ \
|
||||
; \
|
||||
docker-php-ext-configure gmp; \
|
||||
docker-php-ext-install -j "$(nproc)" \
|
||||
intl \
|
||||
zip \
|
||||
json \
|
||||
iconv \
|
||||
bcmath \
|
||||
gd \
|
||||
gmp \
|
||||
pdo_mysql \
|
||||
mysqli \
|
||||
soap \
|
||||
sodium \
|
||||
mbstring \
|
||||
opcache \
|
||||
; \
|
||||
# pecl will claim success even if one install fails, so we need to perform each install separately
|
||||
pecl install APCu-%%APCU_VERSION%%; \
|
||||
pecl install memcached-%%MEMCACHED_VERSION%%; \
|
||||
pecl install redis-%%REDIS_VERSION%%; \
|
||||
\
|
||||
docker-php-ext-enable \
|
||||
apcu \
|
||||
memcached \
|
||||
redis \
|
||||
; \
|
||||
\
|
||||
runDeps="$( \
|
||||
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \
|
||||
| tr ',' '\n' \
|
||||
| sort -u \
|
||||
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
|
||||
)"; \
|
||||
apk add --virtual .monica-phpext-rundeps $runDeps; \
|
||||
apk del .build-deps
|
||||
|
||||
# Set crontab for schedules
|
||||
RUN set -ex; \
|
||||
\
|
||||
rm /var/spool/cron/crontabs/root; \
|
||||
echo '*/5 * * * * php /var/www/html/artisan schedule:run -v > /proc/1/fd/1 2> /proc/1/fd/2' > /var/spool/cron/crontabs/www-data
|
||||
|
||||
# Opcache
|
||||
ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS="0" \
|
||||
PHP_OPCACHE_MAX_ACCELERATED_FILES="20000" \
|
||||
PHP_OPCACHE_MEMORY_CONSUMPTION="192" \
|
||||
PHP_OPCACHE_MAX_WASTED_PERCENTAGE="10"
|
||||
RUN { \
|
||||
echo '[opcache]'; \
|
||||
echo 'opcache.enable=1'; \
|
||||
echo 'opcache.revalidate_freq=0'; \
|
||||
echo "opcache.validate_timestamps=${PHP_OPCACHE_VALIDATE_TIMESTAMPS}"; \
|
||||
echo "opcache.max_accelerated_files=${PHP_OPCACHE_MAX_ACCELERATED_FILES}"; \
|
||||
echo "opcache.memory_consumption=${PHP_OPCACHE_MEMORY_CONSUMPTION}"; \
|
||||
echo "opcache.max_wasted_percentage=${PHP_OPCACHE_MAX_WASTED_PERCENTAGE}"; \
|
||||
echo 'opcache.interned_strings_buffer=16'; \
|
||||
echo 'opcache.fast_shutdown=1'; \
|
||||
} > /usr/local/etc/php/conf.d/opcache-recommended.ini; \
|
||||
\
|
||||
echo 'apc.enable_cli=1' >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini; \
|
||||
\
|
||||
echo 'memory_limit=512M' > /usr/local/etc/php/conf.d/memory-limit.ini
|
||||
|
||||
# Sentry
|
||||
RUN mkdir -p /root/.local/bin; \
|
||||
curl -sL https://sentry.io/get-cli/ | INSTALL_DIR=/root/.local/bin bash
|
||||
|
||||
VOLUME /var/www/html
|
||||
|
||||
# Define Monica version and expected SHA512 signature
|
||||
ENV MONICA_VERSION %%VERSION%%
|
||||
ENV MONICA_SHA512 %%SHA512%%
|
||||
|
||||
RUN set -ex; \
|
||||
apk add --no-cache --virtual .fetch-deps \
|
||||
bzip2 \
|
||||
; \
|
||||
\
|
||||
curl -fsSL -o monica.tar.bz2 "https://github.com/monicahq/monica/releases/download/${MONICA_VERSION}/monica-${MONICA_VERSION}.tar.bz2"; \
|
||||
echo "$MONICA_SHA512 *monica.tar.bz2" | sha512sum -c -; \
|
||||
\
|
||||
mkdir /usr/src/monica; \
|
||||
tar -xf monica.tar.bz2 -C /usr/src/monica --strip-components=1; \
|
||||
rm monica.tar.bz2; \
|
||||
\
|
||||
cp /usr/src/monica/.env.example /usr/src/monica/.env; \
|
||||
chown -R www-data:www-data /usr/src/monica; \
|
||||
\
|
||||
apk del .fetch-deps
|
||||
|
||||
COPY upgrade.exclude \
|
||||
/usr/local/share/
|
||||
COPY entrypoint.sh \
|
||||
queue.sh \
|
||||
cron.sh \
|
||||
/usr/local/bin/
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
||||
CMD ["%%CMD%%"]
|
||||
143
Dockerfile-debian.template
Normal file
143
Dockerfile-debian.template
Normal file
@ -0,0 +1,143 @@
|
||||
FROM php:%%PHP_VERSION%%-%%VARIANT%%
|
||||
|
||||
LABEL maintainer="Alexis Saettler <alexis@saettler.org>"
|
||||
|
||||
# entrypoint.sh dependencies
|
||||
RUN set -ex; \
|
||||
\
|
||||
apt-get update; \
|
||||
apt-get install -y --no-install-recommends \
|
||||
rsync \
|
||||
bash \
|
||||
busybox-static \
|
||||
; \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install required PHP extensions
|
||||
RUN set -ex; \
|
||||
\
|
||||
savedAptMark="$(apt-mark showmanual)"; \
|
||||
\
|
||||
apt-get update; \
|
||||
apt-get install -y --no-install-recommends \
|
||||
libicu-dev \
|
||||
zlib1g-dev \
|
||||
libzip-dev \
|
||||
libpng-dev \
|
||||
libxml2-dev \
|
||||
libfreetype6-dev \
|
||||
libjpeg62-turbo-dev \
|
||||
libgmp-dev \
|
||||
libsodium-dev \
|
||||
libmemcached-dev \
|
||||
; \
|
||||
\
|
||||
debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \
|
||||
if [ ! -e /usr/include/gmp.h ]; then ln -s /usr/include/$debMultiarch/gmp.h /usr/include/gmp.h; fi;\
|
||||
docker-php-ext-configure intl; \
|
||||
docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-png-dir=/usr/include/; \
|
||||
docker-php-ext-configure gmp --with-gmp="/usr/include/$debMultiarch"; \
|
||||
docker-php-ext-install -j$(nproc) \
|
||||
intl \
|
||||
zip \
|
||||
json \
|
||||
iconv \
|
||||
bcmath \
|
||||
gd \
|
||||
gmp \
|
||||
pdo_mysql \
|
||||
mysqli \
|
||||
soap \
|
||||
sodium \
|
||||
mbstring \
|
||||
opcache \
|
||||
; \
|
||||
\
|
||||
# pecl will claim success even if one install fails, so we need to perform each install separately
|
||||
pecl install APCu-%%APCU_VERSION%%; \
|
||||
pecl install memcached-%%MEMCACHED_VERSION%%; \
|
||||
pecl install redis-%%REDIS_VERSION%%; \
|
||||
\
|
||||
docker-php-ext-enable \
|
||||
apcu \
|
||||
memcached \
|
||||
redis \
|
||||
; \
|
||||
\
|
||||
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
|
||||
apt-mark auto '.*' > /dev/null; \
|
||||
apt-mark manual $savedAptMark; \
|
||||
ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \
|
||||
| awk '/=>/ { print $3 }' \
|
||||
| sort -u \
|
||||
| xargs -r dpkg-query -S \
|
||||
| cut -d: -f1 \
|
||||
| sort -u \
|
||||
| xargs -rt apt-mark manual; \
|
||||
\
|
||||
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
|
||||
rm -rf /var/lib/apt/lists/*; \
|
||||
\
|
||||
if command -v a2enmod; then \
|
||||
a2enmod rewrite; \
|
||||
fi
|
||||
|
||||
# Set crontab for schedules
|
||||
RUN set -ex; \
|
||||
\
|
||||
mkdir -p /var/spool/cron/crontabs; \
|
||||
echo '*/5 * * * * php /var/www/html/artisan schedule:run -v > /proc/1/fd/1 2> /proc/1/fd/2' > /var/spool/cron/crontabs/www-data
|
||||
|
||||
# Opcache
|
||||
ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS="0" \
|
||||
PHP_OPCACHE_MAX_ACCELERATED_FILES="20000" \
|
||||
PHP_OPCACHE_MEMORY_CONSUMPTION="192" \
|
||||
PHP_OPCACHE_MAX_WASTED_PERCENTAGE="10"
|
||||
RUN { \
|
||||
echo '[opcache]'; \
|
||||
echo 'opcache.enable=1'; \
|
||||
echo 'opcache.revalidate_freq=0'; \
|
||||
echo "opcache.validate_timestamps=${PHP_OPCACHE_VALIDATE_TIMESTAMPS}"; \
|
||||
echo "opcache.max_accelerated_files=${PHP_OPCACHE_MAX_ACCELERATED_FILES}"; \
|
||||
echo "opcache.memory_consumption=${PHP_OPCACHE_MEMORY_CONSUMPTION}"; \
|
||||
echo "opcache.max_wasted_percentage=${PHP_OPCACHE_MAX_WASTED_PERCENTAGE}"; \
|
||||
echo 'opcache.interned_strings_buffer=16'; \
|
||||
echo 'opcache.fast_shutdown=1'; \
|
||||
} > /usr/local/etc/php/conf.d/opcache-recommended.ini; \
|
||||
\
|
||||
echo 'apc.enable_cli=1' >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini; \
|
||||
\
|
||||
echo 'memory_limit=512M' > /usr/local/etc/php/conf.d/memory-limit.ini
|
||||
|
||||
# Sentry
|
||||
RUN mkdir -p /root/.local/bin; \
|
||||
curl -sL https://sentry.io/get-cli/ | INSTALL_DIR=/root/.local/bin bash
|
||||
|
||||
VOLUME /var/www/html
|
||||
|
||||
# Define Monica version and expected SHA512 signature
|
||||
ENV MONICA_VERSION %%VERSION%%
|
||||
ENV MONICA_SHA512 %%SHA512%%
|
||||
|
||||
%%APACHE_DOCUMENT%%
|
||||
|
||||
RUN set -eu; \
|
||||
curl -fsSL -o monica.tar.bz2 "https://github.com/monicahq/monica/releases/download/${MONICA_VERSION}/monica-${MONICA_VERSION}.tar.bz2"; \
|
||||
echo "$MONICA_SHA512 *monica.tar.bz2" | sha512sum -c -; \
|
||||
\
|
||||
mkdir /usr/src/monica; \
|
||||
tar -xf monica.tar.bz2 -C /usr/src/monica --strip-components=1; \
|
||||
rm monica.tar.bz2; \
|
||||
\
|
||||
cp /usr/src/monica/.env.example /usr/src/monica/.env; \
|
||||
chown -R www-data:www-data /usr/src/monica
|
||||
|
||||
COPY upgrade.exclude \
|
||||
/usr/local/share/
|
||||
COPY entrypoint.sh \
|
||||
queue.sh \
|
||||
cron.sh \
|
||||
/usr/local/bin/
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
||||
CMD ["%%CMD%%"]
|
||||
339
LICENSE
Normal file
339
LICENSE
Normal file
@ -0,0 +1,339 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
||||
145
apache/Dockerfile
Normal file
145
apache/Dockerfile
Normal file
@ -0,0 +1,145 @@
|
||||
FROM php:7.3-apache
|
||||
|
||||
LABEL maintainer="Alexis Saettler <alexis@saettler.org>"
|
||||
|
||||
# entrypoint.sh dependencies
|
||||
RUN set -ex; \
|
||||
\
|
||||
apt-get update; \
|
||||
apt-get install -y --no-install-recommends \
|
||||
rsync \
|
||||
bash \
|
||||
busybox-static \
|
||||
; \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install required PHP extensions
|
||||
RUN set -ex; \
|
||||
\
|
||||
savedAptMark="$(apt-mark showmanual)"; \
|
||||
\
|
||||
apt-get update; \
|
||||
apt-get install -y --no-install-recommends \
|
||||
libicu-dev \
|
||||
zlib1g-dev \
|
||||
libzip-dev \
|
||||
libpng-dev \
|
||||
libxml2-dev \
|
||||
libfreetype6-dev \
|
||||
libjpeg62-turbo-dev \
|
||||
libgmp-dev \
|
||||
libsodium-dev \
|
||||
libmemcached-dev \
|
||||
; \
|
||||
\
|
||||
debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \
|
||||
if [ ! -e /usr/include/gmp.h ]; then ln -s /usr/include/$debMultiarch/gmp.h /usr/include/gmp.h; fi;\
|
||||
docker-php-ext-configure intl; \
|
||||
docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-png-dir=/usr/include/; \
|
||||
docker-php-ext-configure gmp --with-gmp="/usr/include/$debMultiarch"; \
|
||||
docker-php-ext-install -j$(nproc) \
|
||||
intl \
|
||||
zip \
|
||||
json \
|
||||
iconv \
|
||||
bcmath \
|
||||
gd \
|
||||
gmp \
|
||||
pdo_mysql \
|
||||
mysqli \
|
||||
soap \
|
||||
sodium \
|
||||
mbstring \
|
||||
opcache \
|
||||
; \
|
||||
\
|
||||
# pecl will claim success even if one install fails, so we need to perform each install separately
|
||||
pecl install APCu-5.1.18; \
|
||||
pecl install memcached-3.1.5; \
|
||||
pecl install redis-5.1.1; \
|
||||
\
|
||||
docker-php-ext-enable \
|
||||
apcu \
|
||||
memcached \
|
||||
redis \
|
||||
; \
|
||||
\
|
||||
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
|
||||
apt-mark auto '.*' > /dev/null; \
|
||||
apt-mark manual $savedAptMark; \
|
||||
ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \
|
||||
| awk '/=>/ { print $3 }' \
|
||||
| sort -u \
|
||||
| xargs -r dpkg-query -S \
|
||||
| cut -d: -f1 \
|
||||
| sort -u \
|
||||
| xargs -rt apt-mark manual; \
|
||||
\
|
||||
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
|
||||
rm -rf /var/lib/apt/lists/*; \
|
||||
\
|
||||
if command -v a2enmod; then \
|
||||
a2enmod rewrite; \
|
||||
fi
|
||||
|
||||
# Set crontab for schedules
|
||||
RUN set -ex; \
|
||||
\
|
||||
mkdir -p /var/spool/cron/crontabs; \
|
||||
echo '*/5 * * * * php /var/www/html/artisan schedule:run -v > /proc/1/fd/1 2> /proc/1/fd/2' > /var/spool/cron/crontabs/www-data
|
||||
|
||||
# Opcache
|
||||
ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS="0" \
|
||||
PHP_OPCACHE_MAX_ACCELERATED_FILES="20000" \
|
||||
PHP_OPCACHE_MEMORY_CONSUMPTION="192" \
|
||||
PHP_OPCACHE_MAX_WASTED_PERCENTAGE="10"
|
||||
RUN { \
|
||||
echo '[opcache]'; \
|
||||
echo 'opcache.enable=1'; \
|
||||
echo 'opcache.revalidate_freq=0'; \
|
||||
echo "opcache.validate_timestamps=${PHP_OPCACHE_VALIDATE_TIMESTAMPS}"; \
|
||||
echo "opcache.max_accelerated_files=${PHP_OPCACHE_MAX_ACCELERATED_FILES}"; \
|
||||
echo "opcache.memory_consumption=${PHP_OPCACHE_MEMORY_CONSUMPTION}"; \
|
||||
echo "opcache.max_wasted_percentage=${PHP_OPCACHE_MAX_WASTED_PERCENTAGE}"; \
|
||||
echo 'opcache.interned_strings_buffer=16'; \
|
||||
echo 'opcache.fast_shutdown=1'; \
|
||||
} > /usr/local/etc/php/conf.d/opcache-recommended.ini; \
|
||||
\
|
||||
echo 'apc.enable_cli=1' >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini; \
|
||||
\
|
||||
echo 'memory_limit=512M' > /usr/local/etc/php/conf.d/memory-limit.ini
|
||||
|
||||
# Sentry
|
||||
RUN mkdir -p /root/.local/bin; \
|
||||
curl -sL https://sentry.io/get-cli/ | INSTALL_DIR=/root/.local/bin bash
|
||||
|
||||
VOLUME /var/www/html
|
||||
|
||||
# Define Monica version and expected SHA512 signature
|
||||
ENV MONICA_VERSION v2.16.0
|
||||
ENV MONICA_SHA512 f2d1a434b5615bcd100388066854dfd36c81f403e817f45a21d4c04ec9ee022339c25334913586a51e763928d17d8b3fa79b6bf1883cac6fffe1aabfbd14ae3c
|
||||
|
||||
ENV APACHE_DOCUMENT_ROOT /var/www/html/public
|
||||
RUN set -eu; sed -ri -e "s!/var/www/html!${APACHE_DOCUMENT_ROOT}!g" /etc/apache2/sites-available/*.conf; \
|
||||
sed -ri -e "s!/var/www/!${APACHE_DOCUMENT_ROOT}!g" /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf
|
||||
|
||||
RUN set -eu; \
|
||||
curl -fsSL -o monica.tar.bz2 "https://github.com/monicahq/monica/releases/download/${MONICA_VERSION}/monica-${MONICA_VERSION}.tar.bz2"; \
|
||||
echo "$MONICA_SHA512 *monica.tar.bz2" | sha512sum -c -; \
|
||||
\
|
||||
mkdir /usr/src/monica; \
|
||||
tar -xf monica.tar.bz2 -C /usr/src/monica --strip-components=1; \
|
||||
rm monica.tar.bz2; \
|
||||
\
|
||||
cp /usr/src/monica/.env.example /usr/src/monica/.env; \
|
||||
chown -R www-data:www-data /usr/src/monica
|
||||
|
||||
COPY upgrade.exclude \
|
||||
/usr/local/share/
|
||||
COPY entrypoint.sh \
|
||||
queue.sh \
|
||||
cron.sh \
|
||||
/usr/local/bin/
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
||||
CMD ["apache2-foreground"]
|
||||
4
apache/cron.sh
Executable file
4
apache/cron.sh
Executable file
@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
exec busybox crond -f -l 0 -L /proc/1/fd/1
|
||||
89
apache/entrypoint.sh
Executable file
89
apache/entrypoint.sh
Executable file
@ -0,0 +1,89 @@
|
||||
#!/bin/bash
|
||||
|
||||
# return true if specified directory is empty
|
||||
directory_empty() {
|
||||
[ -z "$(ls -A "$1/")" ]
|
||||
}
|
||||
|
||||
# wait for the database to start
|
||||
waitfordb() {
|
||||
HOST=${DB_HOST:-mysql}
|
||||
PORT=${DB_PORT:-3306}
|
||||
echo "Connecting to ${HOST}:${PORT}"
|
||||
|
||||
attempts=0
|
||||
max_attempts=30
|
||||
while [ $attempts -lt $max_attempts ]; do
|
||||
busybox nc -w 1 "${HOST}:${PORT}" && break
|
||||
echo "Waiting for ${HOST}:${PORT}..."
|
||||
sleep 1
|
||||
let "attempts=attempts+1"
|
||||
done
|
||||
|
||||
if [ $attempts -eq $max_attempts ]; then
|
||||
echo "Unable to contact your database at ${HOST}:${PORT}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Waiting for database to settle..."
|
||||
sleep 3
|
||||
}
|
||||
|
||||
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
|
||||
|
||||
MONICASRC=/usr/src/monica
|
||||
MONICADIR=/var/www/html
|
||||
ARTISAN="php ${MONICADIR}/artisan"
|
||||
|
||||
# Update application sources
|
||||
echo "Syncing sources..."
|
||||
if [ "$(id -u)" = 0 ]; then
|
||||
rsync_options="-rlDog --chown www-data:www-data"
|
||||
else
|
||||
rsync_options="-rlD"
|
||||
fi
|
||||
rsync $rsync_options --delete --exclude-from=/usr/local/share/upgrade.exclude $MONICASRC/ $MONICADIR
|
||||
|
||||
for dir in storage; do
|
||||
if [ ! -d "$MONICADIR/$dir" ] || directory_empty "$MONICADIR/$dir"; then
|
||||
rsync $rsync_options --include "/$dir/" --exclude '/*' $MONICASRC/ $MONICADIR
|
||||
fi
|
||||
done
|
||||
echo "...done!"
|
||||
|
||||
# Ensure storage directories are present
|
||||
STORAGE=${MONICADIR}/storage
|
||||
mkdir -p ${STORAGE}/logs
|
||||
mkdir -p ${STORAGE}/app/public
|
||||
mkdir -p ${STORAGE}/framework/views
|
||||
mkdir -p ${STORAGE}/framework/cache
|
||||
mkdir -p ${STORAGE}/framework/sessions
|
||||
chown -R www-data:www-data ${STORAGE}
|
||||
chmod -R g+rw ${STORAGE}
|
||||
|
||||
if [ -z "${APP_KEY:-}" -o "$APP_KEY" = "ChangeMeBy32KeyLengthOrGenerated" ]; then
|
||||
${ARTISAN} key:generate --no-interaction
|
||||
else
|
||||
echo "APP_KEY already set"
|
||||
fi
|
||||
|
||||
# Run migrations
|
||||
waitfordb
|
||||
${ARTISAN} monica:update --force -vv
|
||||
|
||||
if [ -n "${SENTRY_SUPPORT:-}" -a "$SENTRY_SUPPORT" = "true" -a -z "${SENTRY_NORELEASE:-}" -a -n "${SENTRY_ENV:-}" ]; then
|
||||
commit=$(cat .sentry-commit)
|
||||
release=$(cat .sentry-release)
|
||||
${ARTISAN} sentry:release --release="$release" --commit="$commit" --environment="$SENTRY_ENV" -v || true
|
||||
fi
|
||||
|
||||
if [ ! -f "${STORAGE}/oauth-public.key" -o ! -f "${STORAGE}/oauth-private.key" ]; then
|
||||
echo "Passport keys creation ..."
|
||||
${ARTISAN} passport:keys
|
||||
${ARTISAN} passport:client --personal --no-interaction
|
||||
echo "! Please be careful to backup $MONICADIR/storage/oauth-public.key and $MONICADIR/storage/oauth-private.key files !"
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
exec $@
|
||||
4
apache/queue.sh
Executable file
4
apache/queue.sh
Executable file
@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
exec php /var/www/html/artisan queue:work --sleep=10 --timeout=0 --tries=3 --queue=default,migration >/proc/1/fd/1 2>/proc/1/fd/2
|
||||
1
apache/upgrade.exclude
Normal file
1
apache/upgrade.exclude
Normal file
@ -0,0 +1 @@
|
||||
storage
|
||||
4
docker-cron.sh
Executable file
4
docker-cron.sh
Executable file
@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
exec busybox crond -f -l 0 -L /proc/1/fd/1
|
||||
89
docker-entrypoint.sh
Executable file
89
docker-entrypoint.sh
Executable file
@ -0,0 +1,89 @@
|
||||
#!/bin/bash
|
||||
|
||||
# return true if specified directory is empty
|
||||
directory_empty() {
|
||||
[ -z "$(ls -A "$1/")" ]
|
||||
}
|
||||
|
||||
# wait for the database to start
|
||||
waitfordb() {
|
||||
HOST=${DB_HOST:-mysql}
|
||||
PORT=${DB_PORT:-3306}
|
||||
echo "Connecting to ${HOST}:${PORT}"
|
||||
|
||||
attempts=0
|
||||
max_attempts=30
|
||||
while [ $attempts -lt $max_attempts ]; do
|
||||
busybox nc -w 1 "${HOST}:${PORT}" && break
|
||||
echo "Waiting for ${HOST}:${PORT}..."
|
||||
sleep 1
|
||||
let "attempts=attempts+1"
|
||||
done
|
||||
|
||||
if [ $attempts -eq $max_attempts ]; then
|
||||
echo "Unable to contact your database at ${HOST}:${PORT}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Waiting for database to settle..."
|
||||
sleep 3
|
||||
}
|
||||
|
||||
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
|
||||
|
||||
MONICASRC=/usr/src/monica
|
||||
MONICADIR=/var/www/html
|
||||
ARTISAN="php ${MONICADIR}/artisan"
|
||||
|
||||
# Update application sources
|
||||
echo "Syncing sources..."
|
||||
if [ "$(id -u)" = 0 ]; then
|
||||
rsync_options="-rlDog --chown www-data:www-data"
|
||||
else
|
||||
rsync_options="-rlD"
|
||||
fi
|
||||
rsync $rsync_options --delete --exclude-from=/usr/local/share/upgrade.exclude $MONICASRC/ $MONICADIR
|
||||
|
||||
for dir in storage; do
|
||||
if [ ! -d "$MONICADIR/$dir" ] || directory_empty "$MONICADIR/$dir"; then
|
||||
rsync $rsync_options --include "/$dir/" --exclude '/*' $MONICASRC/ $MONICADIR
|
||||
fi
|
||||
done
|
||||
echo "...done!"
|
||||
|
||||
# Ensure storage directories are present
|
||||
STORAGE=${MONICADIR}/storage
|
||||
mkdir -p ${STORAGE}/logs
|
||||
mkdir -p ${STORAGE}/app/public
|
||||
mkdir -p ${STORAGE}/framework/views
|
||||
mkdir -p ${STORAGE}/framework/cache
|
||||
mkdir -p ${STORAGE}/framework/sessions
|
||||
chown -R www-data:www-data ${STORAGE}
|
||||
chmod -R g+rw ${STORAGE}
|
||||
|
||||
if [ -z "${APP_KEY:-}" -o "$APP_KEY" = "ChangeMeBy32KeyLengthOrGenerated" ]; then
|
||||
${ARTISAN} key:generate --no-interaction
|
||||
else
|
||||
echo "APP_KEY already set"
|
||||
fi
|
||||
|
||||
# Run migrations
|
||||
waitfordb
|
||||
${ARTISAN} monica:update --force -vv
|
||||
|
||||
if [ -n "${SENTRY_SUPPORT:-}" -a "$SENTRY_SUPPORT" = "true" -a -z "${SENTRY_NORELEASE:-}" -a -n "${SENTRY_ENV:-}" ]; then
|
||||
commit=$(cat .sentry-commit)
|
||||
release=$(cat .sentry-release)
|
||||
${ARTISAN} sentry:release --release="$release" --commit="$commit" --environment="$SENTRY_ENV" -v || true
|
||||
fi
|
||||
|
||||
if [ ! -f "${STORAGE}/oauth-public.key" -o ! -f "${STORAGE}/oauth-private.key" ]; then
|
||||
echo "Passport keys creation ..."
|
||||
${ARTISAN} passport:keys
|
||||
${ARTISAN} passport:client --personal --no-interaction
|
||||
echo "! Please be careful to backup $MONICADIR/storage/oauth-public.key and $MONICADIR/storage/oauth-private.key files !"
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
exec $@
|
||||
4
docker-queue.sh
Executable file
4
docker-queue.sh
Executable file
@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
exec php /var/www/html/artisan queue:work --sleep=10 --timeout=0 --tries=3 --queue=default,migration >/proc/1/fd/1 2>/proc/1/fd/2
|
||||
137
fpm-alpine/Dockerfile
Normal file
137
fpm-alpine/Dockerfile
Normal file
@ -0,0 +1,137 @@
|
||||
FROM php:7.3-fpm-alpine
|
||||
|
||||
LABEL maintainer="Alexis Saettler <alexis@saettler.org>"
|
||||
|
||||
# entrypoint.sh dependencies
|
||||
RUN set -ex; \
|
||||
\
|
||||
apk add --no-cache \
|
||||
bash \
|
||||
coreutils \
|
||||
rsync \
|
||||
;
|
||||
|
||||
# Install required PHP extensions
|
||||
RUN set -ex; \
|
||||
\
|
||||
apk add --no-cache --virtual .build-deps \
|
||||
$PHPIZE_DEPS \
|
||||
icu-dev \
|
||||
zlib-dev \
|
||||
libzip-dev \
|
||||
libxml2-dev \
|
||||
freetype-dev \
|
||||
libpng-dev \
|
||||
libjpeg-turbo-dev \
|
||||
jpeg-dev \
|
||||
gmp-dev \
|
||||
libsodium-dev \
|
||||
libmemcached-dev \
|
||||
; \
|
||||
\
|
||||
docker-php-ext-configure intl; \
|
||||
docker-php-ext-configure gd \
|
||||
--with-gd \
|
||||
--with-freetype-dir=/usr/include/ \
|
||||
--with-jpeg-dir=/usr/include/ \
|
||||
--with-png-dir=/usr/include/ \
|
||||
; \
|
||||
docker-php-ext-configure gmp; \
|
||||
docker-php-ext-install -j "$(nproc)" \
|
||||
intl \
|
||||
zip \
|
||||
json \
|
||||
iconv \
|
||||
bcmath \
|
||||
gd \
|
||||
gmp \
|
||||
pdo_mysql \
|
||||
mysqli \
|
||||
soap \
|
||||
sodium \
|
||||
mbstring \
|
||||
opcache \
|
||||
; \
|
||||
# pecl will claim success even if one install fails, so we need to perform each install separately
|
||||
pecl install APCu-5.1.18; \
|
||||
pecl install memcached-3.1.5; \
|
||||
pecl install redis-5.1.1; \
|
||||
\
|
||||
docker-php-ext-enable \
|
||||
apcu \
|
||||
memcached \
|
||||
redis \
|
||||
; \
|
||||
\
|
||||
runDeps="$( \
|
||||
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \
|
||||
| tr ',' '\n' \
|
||||
| sort -u \
|
||||
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
|
||||
)"; \
|
||||
apk add --virtual .monica-phpext-rundeps $runDeps; \
|
||||
apk del .build-deps
|
||||
|
||||
# Set crontab for schedules
|
||||
RUN set -ex; \
|
||||
\
|
||||
rm /var/spool/cron/crontabs/root; \
|
||||
echo '*/5 * * * * php /var/www/html/artisan schedule:run -v > /proc/1/fd/1 2> /proc/1/fd/2' > /var/spool/cron/crontabs/www-data
|
||||
|
||||
# Opcache
|
||||
ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS="0" \
|
||||
PHP_OPCACHE_MAX_ACCELERATED_FILES="20000" \
|
||||
PHP_OPCACHE_MEMORY_CONSUMPTION="192" \
|
||||
PHP_OPCACHE_MAX_WASTED_PERCENTAGE="10"
|
||||
RUN { \
|
||||
echo '[opcache]'; \
|
||||
echo 'opcache.enable=1'; \
|
||||
echo 'opcache.revalidate_freq=0'; \
|
||||
echo "opcache.validate_timestamps=${PHP_OPCACHE_VALIDATE_TIMESTAMPS}"; \
|
||||
echo "opcache.max_accelerated_files=${PHP_OPCACHE_MAX_ACCELERATED_FILES}"; \
|
||||
echo "opcache.memory_consumption=${PHP_OPCACHE_MEMORY_CONSUMPTION}"; \
|
||||
echo "opcache.max_wasted_percentage=${PHP_OPCACHE_MAX_WASTED_PERCENTAGE}"; \
|
||||
echo 'opcache.interned_strings_buffer=16'; \
|
||||
echo 'opcache.fast_shutdown=1'; \
|
||||
} > /usr/local/etc/php/conf.d/opcache-recommended.ini; \
|
||||
\
|
||||
echo 'apc.enable_cli=1' >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini; \
|
||||
\
|
||||
echo 'memory_limit=512M' > /usr/local/etc/php/conf.d/memory-limit.ini
|
||||
|
||||
# Sentry
|
||||
RUN mkdir -p /root/.local/bin; \
|
||||
curl -sL https://sentry.io/get-cli/ | INSTALL_DIR=/root/.local/bin bash
|
||||
|
||||
VOLUME /var/www/html
|
||||
|
||||
# Define Monica version and expected SHA512 signature
|
||||
ENV MONICA_VERSION v2.16.0
|
||||
ENV MONICA_SHA512 f2d1a434b5615bcd100388066854dfd36c81f403e817f45a21d4c04ec9ee022339c25334913586a51e763928d17d8b3fa79b6bf1883cac6fffe1aabfbd14ae3c
|
||||
|
||||
RUN set -ex; \
|
||||
apk add --no-cache --virtual .fetch-deps \
|
||||
bzip2 \
|
||||
; \
|
||||
\
|
||||
curl -fsSL -o monica.tar.bz2 "https://github.com/monicahq/monica/releases/download/${MONICA_VERSION}/monica-${MONICA_VERSION}.tar.bz2"; \
|
||||
echo "$MONICA_SHA512 *monica.tar.bz2" | sha512sum -c -; \
|
||||
\
|
||||
mkdir /usr/src/monica; \
|
||||
tar -xf monica.tar.bz2 -C /usr/src/monica --strip-components=1; \
|
||||
rm monica.tar.bz2; \
|
||||
\
|
||||
cp /usr/src/monica/.env.example /usr/src/monica/.env; \
|
||||
chown -R www-data:www-data /usr/src/monica; \
|
||||
\
|
||||
apk del .fetch-deps
|
||||
|
||||
COPY upgrade.exclude \
|
||||
/usr/local/share/
|
||||
COPY entrypoint.sh \
|
||||
queue.sh \
|
||||
cron.sh \
|
||||
/usr/local/bin/
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
||||
CMD ["php-fpm"]
|
||||
4
fpm-alpine/cron.sh
Executable file
4
fpm-alpine/cron.sh
Executable file
@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
exec busybox crond -f -l 0 -L /proc/1/fd/1
|
||||
89
fpm-alpine/entrypoint.sh
Executable file
89
fpm-alpine/entrypoint.sh
Executable file
@ -0,0 +1,89 @@
|
||||
#!/bin/bash
|
||||
|
||||
# return true if specified directory is empty
|
||||
directory_empty() {
|
||||
[ -z "$(ls -A "$1/")" ]
|
||||
}
|
||||
|
||||
# wait for the database to start
|
||||
waitfordb() {
|
||||
HOST=${DB_HOST:-mysql}
|
||||
PORT=${DB_PORT:-3306}
|
||||
echo "Connecting to ${HOST}:${PORT}"
|
||||
|
||||
attempts=0
|
||||
max_attempts=30
|
||||
while [ $attempts -lt $max_attempts ]; do
|
||||
busybox nc -w 1 "${HOST}:${PORT}" && break
|
||||
echo "Waiting for ${HOST}:${PORT}..."
|
||||
sleep 1
|
||||
let "attempts=attempts+1"
|
||||
done
|
||||
|
||||
if [ $attempts -eq $max_attempts ]; then
|
||||
echo "Unable to contact your database at ${HOST}:${PORT}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Waiting for database to settle..."
|
||||
sleep 3
|
||||
}
|
||||
|
||||
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
|
||||
|
||||
MONICASRC=/usr/src/monica
|
||||
MONICADIR=/var/www/html
|
||||
ARTISAN="php ${MONICADIR}/artisan"
|
||||
|
||||
# Update application sources
|
||||
echo "Syncing sources..."
|
||||
if [ "$(id -u)" = 0 ]; then
|
||||
rsync_options="-rlDog --chown www-data:www-data"
|
||||
else
|
||||
rsync_options="-rlD"
|
||||
fi
|
||||
rsync $rsync_options --delete --exclude-from=/usr/local/share/upgrade.exclude $MONICASRC/ $MONICADIR
|
||||
|
||||
for dir in storage; do
|
||||
if [ ! -d "$MONICADIR/$dir" ] || directory_empty "$MONICADIR/$dir"; then
|
||||
rsync $rsync_options --include "/$dir/" --exclude '/*' $MONICASRC/ $MONICADIR
|
||||
fi
|
||||
done
|
||||
echo "...done!"
|
||||
|
||||
# Ensure storage directories are present
|
||||
STORAGE=${MONICADIR}/storage
|
||||
mkdir -p ${STORAGE}/logs
|
||||
mkdir -p ${STORAGE}/app/public
|
||||
mkdir -p ${STORAGE}/framework/views
|
||||
mkdir -p ${STORAGE}/framework/cache
|
||||
mkdir -p ${STORAGE}/framework/sessions
|
||||
chown -R www-data:www-data ${STORAGE}
|
||||
chmod -R g+rw ${STORAGE}
|
||||
|
||||
if [ -z "${APP_KEY:-}" -o "$APP_KEY" = "ChangeMeBy32KeyLengthOrGenerated" ]; then
|
||||
${ARTISAN} key:generate --no-interaction
|
||||
else
|
||||
echo "APP_KEY already set"
|
||||
fi
|
||||
|
||||
# Run migrations
|
||||
waitfordb
|
||||
${ARTISAN} monica:update --force -vv
|
||||
|
||||
if [ -n "${SENTRY_SUPPORT:-}" -a "$SENTRY_SUPPORT" = "true" -a -z "${SENTRY_NORELEASE:-}" -a -n "${SENTRY_ENV:-}" ]; then
|
||||
commit=$(cat .sentry-commit)
|
||||
release=$(cat .sentry-release)
|
||||
${ARTISAN} sentry:release --release="$release" --commit="$commit" --environment="$SENTRY_ENV" -v || true
|
||||
fi
|
||||
|
||||
if [ ! -f "${STORAGE}/oauth-public.key" -o ! -f "${STORAGE}/oauth-private.key" ]; then
|
||||
echo "Passport keys creation ..."
|
||||
${ARTISAN} passport:keys
|
||||
${ARTISAN} passport:client --personal --no-interaction
|
||||
echo "! Please be careful to backup $MONICADIR/storage/oauth-public.key and $MONICADIR/storage/oauth-private.key files !"
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
exec $@
|
||||
4
fpm-alpine/queue.sh
Executable file
4
fpm-alpine/queue.sh
Executable file
@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
exec php /var/www/html/artisan queue:work --sleep=10 --timeout=0 --tries=3 --queue=default,migration >/proc/1/fd/1 2>/proc/1/fd/2
|
||||
1
fpm-alpine/upgrade.exclude
Normal file
1
fpm-alpine/upgrade.exclude
Normal file
@ -0,0 +1 @@
|
||||
storage
|
||||
143
fpm/Dockerfile
Normal file
143
fpm/Dockerfile
Normal file
@ -0,0 +1,143 @@
|
||||
FROM php:7.3-fpm
|
||||
|
||||
LABEL maintainer="Alexis Saettler <alexis@saettler.org>"
|
||||
|
||||
# entrypoint.sh dependencies
|
||||
RUN set -ex; \
|
||||
\
|
||||
apt-get update; \
|
||||
apt-get install -y --no-install-recommends \
|
||||
rsync \
|
||||
bash \
|
||||
busybox-static \
|
||||
; \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install required PHP extensions
|
||||
RUN set -ex; \
|
||||
\
|
||||
savedAptMark="$(apt-mark showmanual)"; \
|
||||
\
|
||||
apt-get update; \
|
||||
apt-get install -y --no-install-recommends \
|
||||
libicu-dev \
|
||||
zlib1g-dev \
|
||||
libzip-dev \
|
||||
libpng-dev \
|
||||
libxml2-dev \
|
||||
libfreetype6-dev \
|
||||
libjpeg62-turbo-dev \
|
||||
libgmp-dev \
|
||||
libsodium-dev \
|
||||
libmemcached-dev \
|
||||
; \
|
||||
\
|
||||
debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \
|
||||
if [ ! -e /usr/include/gmp.h ]; then ln -s /usr/include/$debMultiarch/gmp.h /usr/include/gmp.h; fi;\
|
||||
docker-php-ext-configure intl; \
|
||||
docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-png-dir=/usr/include/; \
|
||||
docker-php-ext-configure gmp --with-gmp="/usr/include/$debMultiarch"; \
|
||||
docker-php-ext-install -j$(nproc) \
|
||||
intl \
|
||||
zip \
|
||||
json \
|
||||
iconv \
|
||||
bcmath \
|
||||
gd \
|
||||
gmp \
|
||||
pdo_mysql \
|
||||
mysqli \
|
||||
soap \
|
||||
sodium \
|
||||
mbstring \
|
||||
opcache \
|
||||
; \
|
||||
\
|
||||
# pecl will claim success even if one install fails, so we need to perform each install separately
|
||||
pecl install APCu-5.1.18; \
|
||||
pecl install memcached-3.1.5; \
|
||||
pecl install redis-5.1.1; \
|
||||
\
|
||||
docker-php-ext-enable \
|
||||
apcu \
|
||||
memcached \
|
||||
redis \
|
||||
; \
|
||||
\
|
||||
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
|
||||
apt-mark auto '.*' > /dev/null; \
|
||||
apt-mark manual $savedAptMark; \
|
||||
ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \
|
||||
| awk '/=>/ { print $3 }' \
|
||||
| sort -u \
|
||||
| xargs -r dpkg-query -S \
|
||||
| cut -d: -f1 \
|
||||
| sort -u \
|
||||
| xargs -rt apt-mark manual; \
|
||||
\
|
||||
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
|
||||
rm -rf /var/lib/apt/lists/*; \
|
||||
\
|
||||
if command -v a2enmod; then \
|
||||
a2enmod rewrite; \
|
||||
fi
|
||||
|
||||
# Set crontab for schedules
|
||||
RUN set -ex; \
|
||||
\
|
||||
mkdir -p /var/spool/cron/crontabs; \
|
||||
echo '*/5 * * * * php /var/www/html/artisan schedule:run -v > /proc/1/fd/1 2> /proc/1/fd/2' > /var/spool/cron/crontabs/www-data
|
||||
|
||||
# Opcache
|
||||
ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS="0" \
|
||||
PHP_OPCACHE_MAX_ACCELERATED_FILES="20000" \
|
||||
PHP_OPCACHE_MEMORY_CONSUMPTION="192" \
|
||||
PHP_OPCACHE_MAX_WASTED_PERCENTAGE="10"
|
||||
RUN { \
|
||||
echo '[opcache]'; \
|
||||
echo 'opcache.enable=1'; \
|
||||
echo 'opcache.revalidate_freq=0'; \
|
||||
echo "opcache.validate_timestamps=${PHP_OPCACHE_VALIDATE_TIMESTAMPS}"; \
|
||||
echo "opcache.max_accelerated_files=${PHP_OPCACHE_MAX_ACCELERATED_FILES}"; \
|
||||
echo "opcache.memory_consumption=${PHP_OPCACHE_MEMORY_CONSUMPTION}"; \
|
||||
echo "opcache.max_wasted_percentage=${PHP_OPCACHE_MAX_WASTED_PERCENTAGE}"; \
|
||||
echo 'opcache.interned_strings_buffer=16'; \
|
||||
echo 'opcache.fast_shutdown=1'; \
|
||||
} > /usr/local/etc/php/conf.d/opcache-recommended.ini; \
|
||||
\
|
||||
echo 'apc.enable_cli=1' >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini; \
|
||||
\
|
||||
echo 'memory_limit=512M' > /usr/local/etc/php/conf.d/memory-limit.ini
|
||||
|
||||
# Sentry
|
||||
RUN mkdir -p /root/.local/bin; \
|
||||
curl -sL https://sentry.io/get-cli/ | INSTALL_DIR=/root/.local/bin bash
|
||||
|
||||
VOLUME /var/www/html
|
||||
|
||||
# Define Monica version and expected SHA512 signature
|
||||
ENV MONICA_VERSION v2.16.0
|
||||
ENV MONICA_SHA512 f2d1a434b5615bcd100388066854dfd36c81f403e817f45a21d4c04ec9ee022339c25334913586a51e763928d17d8b3fa79b6bf1883cac6fffe1aabfbd14ae3c
|
||||
|
||||
|
||||
|
||||
RUN set -eu; \
|
||||
curl -fsSL -o monica.tar.bz2 "https://github.com/monicahq/monica/releases/download/${MONICA_VERSION}/monica-${MONICA_VERSION}.tar.bz2"; \
|
||||
echo "$MONICA_SHA512 *monica.tar.bz2" | sha512sum -c -; \
|
||||
\
|
||||
mkdir /usr/src/monica; \
|
||||
tar -xf monica.tar.bz2 -C /usr/src/monica --strip-components=1; \
|
||||
rm monica.tar.bz2; \
|
||||
\
|
||||
cp /usr/src/monica/.env.example /usr/src/monica/.env; \
|
||||
chown -R www-data:www-data /usr/src/monica
|
||||
|
||||
COPY upgrade.exclude \
|
||||
/usr/local/share/
|
||||
COPY entrypoint.sh \
|
||||
queue.sh \
|
||||
cron.sh \
|
||||
/usr/local/bin/
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
||||
CMD ["php-fpm"]
|
||||
4
fpm/cron.sh
Executable file
4
fpm/cron.sh
Executable file
@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
exec busybox crond -f -l 0 -L /proc/1/fd/1
|
||||
89
fpm/entrypoint.sh
Executable file
89
fpm/entrypoint.sh
Executable file
@ -0,0 +1,89 @@
|
||||
#!/bin/bash
|
||||
|
||||
# return true if specified directory is empty
|
||||
directory_empty() {
|
||||
[ -z "$(ls -A "$1/")" ]
|
||||
}
|
||||
|
||||
# wait for the database to start
|
||||
waitfordb() {
|
||||
HOST=${DB_HOST:-mysql}
|
||||
PORT=${DB_PORT:-3306}
|
||||
echo "Connecting to ${HOST}:${PORT}"
|
||||
|
||||
attempts=0
|
||||
max_attempts=30
|
||||
while [ $attempts -lt $max_attempts ]; do
|
||||
busybox nc -w 1 "${HOST}:${PORT}" && break
|
||||
echo "Waiting for ${HOST}:${PORT}..."
|
||||
sleep 1
|
||||
let "attempts=attempts+1"
|
||||
done
|
||||
|
||||
if [ $attempts -eq $max_attempts ]; then
|
||||
echo "Unable to contact your database at ${HOST}:${PORT}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Waiting for database to settle..."
|
||||
sleep 3
|
||||
}
|
||||
|
||||
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
|
||||
|
||||
MONICASRC=/usr/src/monica
|
||||
MONICADIR=/var/www/html
|
||||
ARTISAN="php ${MONICADIR}/artisan"
|
||||
|
||||
# Update application sources
|
||||
echo "Syncing sources..."
|
||||
if [ "$(id -u)" = 0 ]; then
|
||||
rsync_options="-rlDog --chown www-data:www-data"
|
||||
else
|
||||
rsync_options="-rlD"
|
||||
fi
|
||||
rsync $rsync_options --delete --exclude-from=/usr/local/share/upgrade.exclude $MONICASRC/ $MONICADIR
|
||||
|
||||
for dir in storage; do
|
||||
if [ ! -d "$MONICADIR/$dir" ] || directory_empty "$MONICADIR/$dir"; then
|
||||
rsync $rsync_options --include "/$dir/" --exclude '/*' $MONICASRC/ $MONICADIR
|
||||
fi
|
||||
done
|
||||
echo "...done!"
|
||||
|
||||
# Ensure storage directories are present
|
||||
STORAGE=${MONICADIR}/storage
|
||||
mkdir -p ${STORAGE}/logs
|
||||
mkdir -p ${STORAGE}/app/public
|
||||
mkdir -p ${STORAGE}/framework/views
|
||||
mkdir -p ${STORAGE}/framework/cache
|
||||
mkdir -p ${STORAGE}/framework/sessions
|
||||
chown -R www-data:www-data ${STORAGE}
|
||||
chmod -R g+rw ${STORAGE}
|
||||
|
||||
if [ -z "${APP_KEY:-}" -o "$APP_KEY" = "ChangeMeBy32KeyLengthOrGenerated" ]; then
|
||||
${ARTISAN} key:generate --no-interaction
|
||||
else
|
||||
echo "APP_KEY already set"
|
||||
fi
|
||||
|
||||
# Run migrations
|
||||
waitfordb
|
||||
${ARTISAN} monica:update --force -vv
|
||||
|
||||
if [ -n "${SENTRY_SUPPORT:-}" -a "$SENTRY_SUPPORT" = "true" -a -z "${SENTRY_NORELEASE:-}" -a -n "${SENTRY_ENV:-}" ]; then
|
||||
commit=$(cat .sentry-commit)
|
||||
release=$(cat .sentry-release)
|
||||
${ARTISAN} sentry:release --release="$release" --commit="$commit" --environment="$SENTRY_ENV" -v || true
|
||||
fi
|
||||
|
||||
if [ ! -f "${STORAGE}/oauth-public.key" -o ! -f "${STORAGE}/oauth-private.key" ]; then
|
||||
echo "Passport keys creation ..."
|
||||
${ARTISAN} passport:keys
|
||||
${ARTISAN} passport:client --personal --no-interaction
|
||||
echo "! Please be careful to backup $MONICADIR/storage/oauth-public.key and $MONICADIR/storage/oauth-private.key files !"
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
exec $@
|
||||
4
fpm/queue.sh
Executable file
4
fpm/queue.sh
Executable file
@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
exec php /var/www/html/artisan queue:work --sleep=10 --timeout=0 --tries=3 --queue=default,migration >/proc/1/fd/1 2>/proc/1/fd/2
|
||||
1
fpm/upgrade.exclude
Normal file
1
fpm/upgrade.exclude
Normal file
@ -0,0 +1 @@
|
||||
storage
|
||||
91
generate-stackbrew-library.sh
Executable file
91
generate-stackbrew-library.sh
Executable file
@ -0,0 +1,91 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
self="$(basename "$BASH_SOURCE")"
|
||||
cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"
|
||||
defaultVariant='apache'
|
||||
|
||||
# Get the most recent commit which modified any of "$@".
|
||||
fileCommit() {
|
||||
git log -1 --format='format:%H' HEAD -- "$@"
|
||||
}
|
||||
|
||||
# Get the most recent commit which modified "$1/Dockerfile" or any file that
|
||||
# the Dockerfile copies into the rootfs (with COPY).
|
||||
dockerfileCommit() {
|
||||
local dir="$1"; shift
|
||||
(
|
||||
cd "$dir";
|
||||
fileCommit Dockerfile \
|
||||
$(git show HEAD:./Dockerfile | awk '
|
||||
toupper($1) == "COPY" {
|
||||
for (i = 2; i < NF; i++)
|
||||
print $i;
|
||||
}
|
||||
')
|
||||
)
|
||||
}
|
||||
|
||||
getArches() {
|
||||
local repo="$1"; shift
|
||||
local officialImagesUrl='https://github.com/docker-library/official-images/raw/master/library/'
|
||||
|
||||
eval "declare -g -A parentRepoToArches=( $(
|
||||
find -name 'Dockerfile' -exec awk '
|
||||
toupper($1) == "FROM" && $2 !~ /^('"$repo"'|scratch|microsoft\/[^:]+)(:|$)/ {
|
||||
print "'"$officialImagesUrl"'" $2
|
||||
}
|
||||
' '{}' + \
|
||||
| sort -u \
|
||||
| xargs bashbrew cat --format '[{{ .RepoName }}:{{ .TagName }}]="{{ join " " .TagEntry.Architectures }}"'
|
||||
) )"
|
||||
}
|
||||
getArches 'postfixadmin'
|
||||
|
||||
# Header.
|
||||
cat <<-EOH
|
||||
# This file is generated via https://github.com/monicahq/docker/blob/$(fileCommit "$self")/$self
|
||||
Maintainers: Alexis Saettler <alexis@saettler.org>
|
||||
GitRepo: https://github.com/monicahq/docker.git
|
||||
EOH
|
||||
|
||||
# prints "$2$1$3$1...$N"
|
||||
join() {
|
||||
local sep="$1"; shift
|
||||
local out; printf -v out "${sep//%/%%}%s" "$@"
|
||||
echo "${out#$sep}"
|
||||
}
|
||||
|
||||
SEARCHFOR="Upgrade available - the latest version is "
|
||||
latest="$(curl -fsSL 'https://api.github.com/repos/monicahq/monica/releases/latest' | jq -r '.tag_name')"
|
||||
|
||||
variants=( */ )
|
||||
variants=( "${variants[@]%/}" )
|
||||
|
||||
for variant in "${variants[@]}"; do
|
||||
commit="$(dockerfileCommit "$variant")"
|
||||
fullversion="$(git show "$commit":"$variant/Dockerfile" | grep -iF "ARG MONICA_VERSION" | sed -E "s@ARG MONICA_VERSION=([0-9.]+)@\1@")"
|
||||
|
||||
versionAliases=( "$fullversion" "${fullversion%.*}" "${fullversion%.*.*}" )
|
||||
if [ "$fullversion" = "$latest" ]; then
|
||||
versionAliases+=( "latest" )
|
||||
fi
|
||||
|
||||
variantAliases=( "${versionAliases[@]/%/-$variant}" )
|
||||
variantAliases=( "${variantAliases[@]//latest-}" )
|
||||
|
||||
if [ "$variant" = "$defaultVariant" ]; then
|
||||
variantAliases+=( "${versionAliases[@]}" )
|
||||
fi
|
||||
|
||||
variantParent="$(awk 'toupper($1) == "FROM" { print $2 }' "$variant/Dockerfile")"
|
||||
variantArches="${parentRepoToArches[$variantParent]}"
|
||||
|
||||
cat <<-EOE
|
||||
|
||||
Tags: $(join ', ' "${variantAliases[@]}")
|
||||
Architectures: $(join ', ' $variantArches)
|
||||
Directory: $variant
|
||||
GitCommit: $commit
|
||||
EOE
|
||||
done
|
||||
93
update.sh
Executable file
93
update.sh
Executable file
@ -0,0 +1,93 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
IFS='
|
||||
'
|
||||
|
||||
declare -A php_version=(
|
||||
[default]='7.3'
|
||||
)
|
||||
|
||||
declare -A cmd=(
|
||||
[apache]='apache2-foreground'
|
||||
[fpm]='php-fpm'
|
||||
[fpm-alpine]='php-fpm'
|
||||
)
|
||||
|
||||
declare -A base=(
|
||||
[apache]='debian'
|
||||
[fpm]='debian'
|
||||
[fpm-alpine]='alpine'
|
||||
)
|
||||
|
||||
declare -A document=(
|
||||
[apache]="ENV APACHE_DOCUMENT_ROOT /var/www/html/public\\n\
|
||||
RUN set -eu; sed -ri -e \"s!/var/www/html!\\\${APACHE_DOCUMENT_ROOT}!g\" /etc/apache2/sites-available/*.conf; \\\\\\n\
|
||||
sed -ri -e \"s!/var/www/!\\\${APACHE_DOCUMENT_ROOT}!g\" /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf"
|
||||
[fpm]=''
|
||||
[fpm-alpine]=''
|
||||
)
|
||||
|
||||
apcu_version="$(
|
||||
git ls-remote --tags https://github.com/krakjoe/apcu.git \
|
||||
| cut -d/ -f3 \
|
||||
| grep -vE -- '-rc|-b' \
|
||||
| sed -E 's/^v//' \
|
||||
| sort -V \
|
||||
| tail -1
|
||||
)"
|
||||
|
||||
memcached_version="$(
|
||||
git ls-remote --tags https://github.com/php-memcached-dev/php-memcached.git \
|
||||
| cut -d/ -f3 \
|
||||
| grep -vE -- '-rc|-b' \
|
||||
| sed -E 's/^[rv]//' \
|
||||
| sort -V \
|
||||
| tail -1
|
||||
)"
|
||||
|
||||
redis_version="$(
|
||||
git ls-remote --tags https://github.com/phpredis/phpredis.git \
|
||||
| cut -d/ -f3 \
|
||||
| grep -viE '[a-z]' \
|
||||
| tr -d '^{}' \
|
||||
| sort -V \
|
||||
| tail -1
|
||||
)"
|
||||
|
||||
declare -A pecl_versions=(
|
||||
[APCu]="$apcu_version"
|
||||
[memcached]="$memcached_version"
|
||||
[redis]="$redis_version"
|
||||
)
|
||||
|
||||
version="$(curl -fsSL 'https://api.github.com/repos/monicahq/monica/releases/latest' | jq -r '.tag_name')"
|
||||
sha512="$(curl -fsSL "https://github.com/monicahq/monica/releases/download/$version/monica-$version.sha512" | grep monica-$version.tar.bz2 | awk '{ print $1 }')"
|
||||
|
||||
set -x
|
||||
|
||||
for variant in apache fpm fpm-alpine; do
|
||||
rm -rf $variant
|
||||
mkdir -p $variant
|
||||
phpVersion=${php_version[$version]-${php_version[default]}}
|
||||
|
||||
template="Dockerfile-${base[$variant]}.template"
|
||||
sed -e '
|
||||
s/%%VARIANT%%/'"$variant"'/;
|
||||
s/%%PHP_VERSION%%/'"$phpVersion"'/;
|
||||
s/%%VERSION%%/'"$version"'/;
|
||||
s/%%SHA512%%/'"$sha512"'/;
|
||||
s/%%CMD%%/'"${cmd[$variant]}"'/;
|
||||
s#%%APACHE_DOCUMENT%%#'"${document[$variant]}"'#;
|
||||
s/%%APCU_VERSION%%/'"${pecl_versions[APCu]}"'/;
|
||||
s/%%MEMCACHED_VERSION%%/'"${pecl_versions[memcached]}"'/;
|
||||
s/%%REDIS_VERSION%%/'"${pecl_versions[redis]}"'/;
|
||||
' \
|
||||
$template > "$variant/Dockerfile"
|
||||
|
||||
for file in entrypoint cron queue; do
|
||||
cp docker-$file.sh $variant/$file.sh
|
||||
done
|
||||
|
||||
cp upgrade.exclude $variant/
|
||||
done
|
||||
1
upgrade.exclude
Normal file
1
upgrade.exclude
Normal file
@ -0,0 +1 @@
|
||||
storage
|
||||
Loading…
Reference in New Issue
Block a user