mirror of
https://github.com/invoiceninja/dockerfiles.git
synced 2026-01-01 12:07:26 +01:00
Compare commits
25 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c6e122b81f | ||
|
|
421a1f10e6 | ||
|
|
84db77cde8 | ||
|
|
e8706de11c | ||
|
|
960a85d8a7 | ||
|
|
6cd85f48cd | ||
|
|
eca3af3da5 | ||
|
|
b141cfe449 | ||
|
|
3104ec0be9 | ||
|
|
acd778f815 | ||
|
|
0641860c3f | ||
|
|
f6564ffb14 | ||
|
|
d751217d9a | ||
|
|
9bd40b98df | ||
|
|
54f789d5a1 | ||
|
|
a6644abaa2 | ||
|
|
d42e333248 | ||
|
|
2e4ccb920b | ||
|
|
ebe353ca52 | ||
|
|
1af91f451d | ||
|
|
386f6ed8c1 | ||
|
|
73e88f6042 | ||
|
|
758709a796 | ||
|
|
a67de32b6e | ||
|
|
49d3e562de |
@@ -28,7 +28,7 @@ RUN npm install --production \
|
||||
&& npm run production \
|
||||
&& rm -rf node_modules \
|
||||
&& mv /var/www/app/storage $BAK_STORAGE_PATH \
|
||||
&& mv /var/www/app/public $BAK_PUBLIC_PATH
|
||||
&& mv /var/www/app/public $BAK_PUBLIC_PATH
|
||||
|
||||
# Prepare php image
|
||||
FROM php:${PHP_VERSION}-fpm-alpine
|
||||
@@ -66,12 +66,14 @@ RUN install-php-extensions \
|
||||
# Install chromium
|
||||
RUN set -eux; \
|
||||
apk add --no-cache \
|
||||
supervisor \
|
||||
mysql-client \
|
||||
git \
|
||||
chromium \
|
||||
ttf-freefont
|
||||
|
||||
COPY ./config/php/php.ini /usr/local/etc/php/conf.d/in-php.ini
|
||||
COPY ./config/supervisor/supervisord.conf /
|
||||
|
||||
## Separate user
|
||||
ARG UID=1500
|
||||
@@ -86,7 +88,9 @@ RUN addgroup --gid=$UID -S "$INVOICENINJA_USER" \
|
||||
--no-create-home \
|
||||
"$INVOICENINJA_USER" \
|
||||
&& addgroup "$INVOICENINJA_USER" www-data \
|
||||
&& chown -R "$INVOICENINJA_USER":"$INVOICENINJA_USER" /var/www/app
|
||||
&& mkdir /var/log/supervisord /var/run/supervisord \
|
||||
&& chown -R "$INVOICENINJA_USER":"$INVOICENINJA_USER" /var/www/app \
|
||||
&& chown $INVOICENINJA_USER:www-data /var/log/supervisord /var/run/supervisord
|
||||
|
||||
USER $UID
|
||||
|
||||
@@ -98,4 +102,4 @@ ENV LOG errorlog
|
||||
ENV SNAPPDF_EXECUTABLE_PATH /usr/bin/chromium-browser
|
||||
|
||||
ENTRYPOINT ["docker-entrypoint"]
|
||||
CMD ["php-fpm"]
|
||||
CMD ["/usr/bin/supervisord", "-c", "/supervisord.conf"]
|
||||
@@ -1,16 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "Early Entry"
|
||||
|
||||
cleanup ()
|
||||
{
|
||||
kill -s SIGTERM $!
|
||||
exit 0
|
||||
}
|
||||
|
||||
trap cleanup SIGINT SIGTERM
|
||||
|
||||
while :
|
||||
do
|
||||
sleep 60 ; cd /var/www/app/ && php artisan schedule:run;
|
||||
done
|
||||
8
config/shutdown.sh
Normal file
8
config/shutdown.sh
Normal file
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
printf "READY\n";
|
||||
|
||||
while read line; do
|
||||
echo "Processing Event: $line" >&2;
|
||||
kill -SIGQUIT $PPID
|
||||
done < /dev/stdin
|
||||
47
config/supervisor/supervisord.conf
Normal file
47
config/supervisor/supervisord.conf
Normal file
@@ -0,0 +1,47 @@
|
||||
[supervisord]
|
||||
nodaemon=true
|
||||
user=invoiceninja
|
||||
pidfile=/var/run/supervisord/supervisord.pid
|
||||
logfile=/dev/null ; nodaemon will cause logs to go to stdout
|
||||
logfile_maxbytes=0
|
||||
loglevel=error
|
||||
|
||||
[program:php-fpm]
|
||||
autostart=true
|
||||
autorestart=true
|
||||
redirect_stderr=true
|
||||
stdout_logfile=/dev/stdout
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/dev/stderr
|
||||
stderr_logfile_maxbytes=0
|
||||
command=php-fpm
|
||||
|
||||
[program:scheduler]
|
||||
autostart=true
|
||||
autorestart=true
|
||||
redirect_stderr=true
|
||||
stdout_logfile=/dev/stdout
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/dev/stderr
|
||||
stderr_logfile_maxbytes=0
|
||||
command=php artisan schedule:work
|
||||
|
||||
[program:queue-worker]
|
||||
process_name=%(program_name)s_%(process_num)02d
|
||||
autostart=true
|
||||
autorestart=true
|
||||
redirect_stderr=true
|
||||
stdout_logfile=/dev/stdout
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/dev/stderr
|
||||
stderr_logfile_maxbytes=0
|
||||
numprocs=2
|
||||
command=php artisan queue:work --sleep=3 --tries=3 --memory=256
|
||||
|
||||
[eventlistener:shutdown]
|
||||
command=/shutdown.sh
|
||||
events=PROCESS_STATE_STOPPED, PROCESS_STATE_EXITED, PROCESS_STATE_FATAL
|
||||
stdout_logfile=/dev/stdout
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/dev/stderr
|
||||
stderr_logfile_maxbytes=0
|
||||
@@ -9,7 +9,6 @@ services:
|
||||
# Vhost configuration
|
||||
#- ./config/caddy/Caddyfile:/etc/caddy/Caddyfiledocker-com
|
||||
- ./config/nginx/in-vhost.conf:/etc/nginx/conf.d/in-vhost.conf:ro
|
||||
# you may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!
|
||||
- ./docker/app/public:/var/www/app/public:rw,delegated
|
||||
- ./docker/app/storage:/var/www/app/storage:rw,delegated
|
||||
depends_on:
|
||||
@@ -29,8 +28,8 @@ services:
|
||||
env_file: env
|
||||
restart: always
|
||||
volumes:
|
||||
# you may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!
|
||||
- ./config/hosts:/etc/hosts:ro
|
||||
- ./config/shutdown.sh:/usr/local/bin/shutdown.sh
|
||||
- ./docker/app/public:/var/www/app/public:rw,delegated
|
||||
- ./docker/app/storage:/var/www/app/storage:rw,delegated
|
||||
depends_on:
|
||||
@@ -51,31 +50,12 @@ services:
|
||||
- MYSQL_PASSWORD=ninja
|
||||
- MYSQL_DATABASE=ninja
|
||||
volumes:
|
||||
# you may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!
|
||||
- ./docker/mysql/data:/var/lib/mysql:rw,delegated
|
||||
networks:
|
||||
- invoiceninja
|
||||
extra_hosts:
|
||||
- "in5.localhost:192.168.0.124 " #host and ip
|
||||
|
||||
# THIS IS ONLY A VALID CONFIGURATION FOR IN 5. DO NOT USE FOR IN 4.
|
||||
cron:
|
||||
image: invoiceninja/invoiceninja:5
|
||||
env_file: env
|
||||
volumes:
|
||||
- ./config/cron.sh:/usr/local/bin/cron.sh
|
||||
- ./config/hosts:/etc/hosts:ro
|
||||
- ./docker/app/public:/var/www/app/public:rw,delegated
|
||||
- ./docker/app/storage:/var/www/app/storage:rw,delegated
|
||||
command:
|
||||
- cron.sh
|
||||
depends_on:
|
||||
- app
|
||||
networks:
|
||||
- invoiceninja
|
||||
extra_hosts:
|
||||
- "in5.localhost:192.168.0.124 " #host and ip
|
||||
|
||||
# THIS IS ONLY A VALID CONFIGURATION FOR IN 4. DO NOT USE FOR IN 5.
|
||||
# cron:
|
||||
# image: invoiceninja/invoiceninja:alpine-4
|
||||
|
||||
13
examples/v5/supervisor/Dockerfile
Normal file
13
examples/v5/supervisor/Dockerfile
Normal file
@@ -0,0 +1,13 @@
|
||||
FROM invoiceninja/invoiceninja:5
|
||||
|
||||
USER root
|
||||
|
||||
RUN apk add --no-cache supervisor \
|
||||
&& mkdir /var/log/supervisord /var/run/supervisord \
|
||||
&& chown $INVOICENINJA_USER:www-data /var/log/supervisord /var/run/supervisord
|
||||
|
||||
COPY supervisord.conf /
|
||||
|
||||
USER $INVOICENINJA_USER
|
||||
|
||||
CMD ["/usr/bin/supervisord", "-c", "/supervisord.conf"]
|
||||
29
examples/v5/supervisor/supervisord.conf
Normal file
29
examples/v5/supervisor/supervisord.conf
Normal file
@@ -0,0 +1,29 @@
|
||||
[supervisord]
|
||||
nodaemon=true
|
||||
user=invoiceninja
|
||||
pidfile=/var/run/supervisord/supervisord.pid
|
||||
logfile=/dev/null ; nodaemon will cause logs to go to stdout
|
||||
logfile_maxbytes=0
|
||||
loglevel=error
|
||||
|
||||
[program:php-fpm]
|
||||
stdout_logfile=/dev/stdout
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/dev/stderr
|
||||
stderr_logfile_maxbytes=0
|
||||
command=php-fpm
|
||||
|
||||
[program:scheduler]
|
||||
stdout_logfile=/dev/stdout
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/dev/stderr
|
||||
stderr_logfile_maxbytes=0
|
||||
command=php artisan schedule:work
|
||||
|
||||
[program:queue-worker]
|
||||
stdout_logfile=/dev/stdout
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/dev/stderr
|
||||
stderr_logfile_maxbytes=0
|
||||
numprocs=2
|
||||
command=php artisan queue:work --sleep=3 --tries=1 --memory=1024 --timeout=3600 --daemon
|
||||
Reference in New Issue
Block a user