Skip to content

Commit 7e466b3

Browse files
authored
Merge pull request #715 from invoiceninja/revert-689-master
Revert "Align alpine to debian and octane for maintenance"
2 parents 3bf4174 + c5bb796 commit 7e466b3

File tree

14 files changed

+168
-165
lines changed

14 files changed

+168
-165
lines changed

alpine/5/Dockerfile

Lines changed: 36 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,65 @@
1-
ARG PHP_VERSION=8.3
2-
ARG ALPINE_VERSION=3.20
1+
ARG PHP_VERSION=8.2
32
ARG BAK_STORAGE_PATH=/var/www/app/docker-backup-storage/
43
ARG BAK_PUBLIC_PATH=/var/www/app/docker-backup-public/
54

65
# Get Invoice Ninja and install nodejs packages
7-
FROM --platform=$BUILDPLATFORM php:${PHP_VERSION}-fpm-alpine${ALPINE_VERSION} AS nodebuild
6+
FROM --platform=$BUILDPLATFORM node:lts-alpine as nodebuild
87

98
# Download Invoice Ninja
109
ARG INVOICENINJA_VERSION
1110
ARG REPOSITORY=invoiceninja/invoiceninja
1211
ARG FILENAME=invoiceninja.tar
1312

14-
RUN mkdir -p /var/www/app
13+
RUN set -eux; apk add curl unzip grep
1514

16-
# Extract Invoice Ninja
17-
RUN apk add --no-cache curl \
18-
&& curl -s "https://api.github.com/repos/invoiceninja/invoiceninja/releases/latest" | \
19-
grep -o '"browser_download_url": "[^"]*invoiceninja.tar.gz"' | \
20-
cut -d '"' -f 4 | \
21-
xargs curl -sL | \
22-
tar -xz --strip-components=1 -C /var/www/app/ \
23-
&& apk --purge del curl
24-
25-
RUN mkdir -p /var/www/app/public/logo /var/www/app/storage
15+
RUN DOWNLOAD_URL=$(curl -s "https://api.github.com/repos/invoiceninja/invoiceninja/releases/latest" | grep -o '"browser_download_url": "[^"]*invoiceninja.tar"' | cut -d '"' -f 4) && \
16+
curl -LJO "$DOWNLOAD_URL" && \
17+
mv invoiceninja.tar /tmp/ninja.tar
2618

19+
# Extract Invoice Ninja
20+
RUN mkdir -p /var/www/app \
21+
&& tar -xvf /tmp/ninja.tar -C /var/www/app/ \
22+
&& mkdir -p /var/www/app/public/logo /var/www/app/storage
23+
2724
WORKDIR /var/www/app
2825

2926
# Prepare php image
30-
FROM php:${PHP_VERSION}-fpm-alpine${ALPINE_VERSION} AS phpbuild
27+
FROM php:${PHP_VERSION}-fpm-alpine as phpbuild
3128

3229
LABEL maintainer="David Bomba <[email protected]>"
3330

34-
ARG php_require="bcmath gd pdo_mysql zip"
35-
ARG php_suggest="exif imagick intl pcntl soap"
36-
ARG php_extra="opcache"
31+
# Adding caching_sha2_password.so
32+
# With this we get native support for caching_sha2_password
33+
RUN apk add --no-cache mariadb-connector-c
3734

38-
RUN ln -s "${PHP_INI_DIR}/php.ini-production" "${PHP_INI_DIR}/php.ini"
35+
RUN mv /usr/local/etc/php/php.ini-production /usr/local/etc/php/php.ini
36+
37+
# Install PHP extensions
38+
# https://hub.docker.com/r/mlocati/php-extension-installer/tags
39+
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
3940

4041
# Install chromium
4142
RUN set -eux; \
4243
apk add --no-cache \
4344
font-isas-misc \
4445
supervisor \
45-
mariadb-client \
46-
mariadb-connector-c \
46+
mysql-client \
4747
chromium \
48-
# font-noto-cjk-extra \
49-
# font-wqy-zenhei \
5048
ttf-freefont \
5149
ttf-dejavu
5250

53-
# Install PHP extensions
54-
RUN ( curl -sSLf https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions -o - || echo 'return 1' ) | sh -s \
55-
${php_require} \
56-
${php_suggest} \
57-
${php_extra}
51+
RUN install-php-extensions \
52+
bcmath \
53+
exif \
54+
gd \
55+
gmp \
56+
mysqli \
57+
opcache \
58+
pdo_mysql \
59+
zip \
60+
intl \
61+
@composer \
62+
&& rm /usr/local/bin/install-php-extensions
5863

5964
# Copy files
6065
COPY rootfs /
@@ -82,6 +87,8 @@ ENV BAK_STORAGE_PATH $BAK_STORAGE_PATH
8287
ENV BAK_PUBLIC_PATH $BAK_PUBLIC_PATH
8388
COPY --from=nodebuild --chown=$INVOICENINJA_USER:$INVOICENINJA_USER /var/www/app /var/www/app
8489

90+
RUN rm -rf /var/www/app/ui
91+
8592
USER $UID
8693
WORKDIR /var/www/app
8794

@@ -99,7 +106,7 @@ ARG BAK_PUBLIC_PATH
99106
RUN mv /var/www/app/storage $BAK_STORAGE_PATH \
100107
&& mv /var/www/app/public $BAK_PUBLIC_PATH
101108

102-
FROM phpbuild AS prod
109+
FROM phpbuild as prod
103110

104111
COPY --from=dependencybuild --chown=$INVOICENINJA_USER:$INVOICENINJA_USER /var/www/app /var/www/app
105112

alpine/5/rootfs/etc/supervisord.conf

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,37 @@
11
[supervisord]
22
nodaemon=true
3-
logfile=/dev/null
3+
pidfile=/tmp/supervisord.pid
4+
logfile=/dev/null ; nodaemon will cause logs to go to stdout
45
logfile_maxbytes=0
5-
6-
[rpcinterface:supervisor]
7-
supervisor.rpcinterface_factory=supervisor.rpcinterface:make_main_rpcinterface
6+
loglevel=info
87

98
[program:php-fpm]
10-
command=php-fpm
11-
stdout_logfile=/dev/fd/1
12-
stdout_logfile_maxbytes=0
139
redirect_stderr=true
10+
stdout_logfile=/dev/stdout
11+
stdout_logfile_maxbytes=0
12+
stderr_logfile=/dev/stderr
13+
stderr_logfile_maxbytes=0
14+
command=php-fpm
1415

1516
[program:scheduler]
16-
command=php artisan schedule:work
1717
autorestart=true
18-
stdout_logfile=/dev/fd/1
19-
stdout_logfile_maxbytes=0
2018
redirect_stderr=true
19+
stdout_logfile=/dev/stdout
20+
stdout_logfile_maxbytes=0
21+
stderr_logfile=/dev/stderr
22+
stderr_logfile_maxbytes=0
23+
command=php artisan schedule:work
2124

2225
[program:queue-worker]
2326
process_name=%(program_name)s_%(process_num)02d
24-
command=php artisan queue:work --sleep=3 --tries=1 --timeout=3600
25-
autostart=true
2627
autorestart=true
27-
stopasgroup=true
28-
killasgroup=true
29-
numprocs=2
30-
stdout_logfile=/dev/fd/1
31-
stdout_logfile_maxbytes=0
3228
redirect_stderr=true
33-
stopwaitsecs=3600
29+
stdout_logfile=/dev/stdout
30+
stdout_logfile_maxbytes=0
31+
stderr_logfile=/dev/stderr
32+
stderr_logfile_maxbytes=0
33+
numprocs=2
34+
command=php artisan queue:work --sleep=3 --tries=1 --memory=256 --timeout=3600
3435

3536
[eventlistener:shutdown]
3637
command=shutdown.sh

alpine/5/rootfs/usr/local/bin/invoiceninja-init.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ php artisan optimize
3030
php artisan package:discover
3131

3232
# Check if DB works, if not crash the app.
33-
DB_READY=$(php -d opcache.preload='' artisan tinker --execute='echo app()->call("App\Utils\SystemHealth@dbCheck")["success"];')
33+
DB_READY=$(php artisan tinker --execute='echo app()->call("App\Utils\SystemHealth@dbCheck")["success"];')
3434
if [ "$DB_READY" != "1" ]; then
3535
php artisan migrate:status # Print verbose error
3636
in_error "Error connecting to DB"
@@ -39,7 +39,7 @@ fi
3939
php artisan migrate --force
4040

4141
# If first IN run, it needs to be initialized
42-
IN_INIT=$(php -d opcache.preload='' artisan tinker --execute='echo Schema::hasTable("accounts") && !App\Models\Account::all()->first();')
42+
IN_INIT=$(php artisan tinker --execute='echo Schema::hasTable("accounts") && !App\Models\Account::all()->first();')
4343
if [ "$IN_INIT" == "1" ]; then
4444
docker_process_init_files /docker-entrypoint-init.d/*
4545
fi

alpine/5/rootfs/usr/local/etc/php-fpm.d/invoiceninja.conf

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
; How often (in seconds) to check file timestamps for changes to the shared
2+
; memory storage allocation. ("1" means validate once per second, but only
3+
; once per request. "0" means always validate)
4+
;opcache.revalidate_freq=2
5+
opcache.revalidate_freq=60
6+
7+
# http://symfony.com/doc/current/performance.html
8+
; Duration of time, in seconds for which to cache realpath information for a given
9+
; file or directory. For systems with rarely changing files, consider increasing this
10+
; value.
11+
; http://php.net/realpath-cache-ttl
12+
;realpath_cache_ttl = 120
13+
realpath_cache_ttl = 600
14+
15+
; Maximum allowed size for uploaded files.
16+
; http://php.net/upload-max-filesize
17+
upload_max_filesize = 8M

alpine/5/rootfs/usr/local/etc/php/conf.d/invoiceninja.ini

Lines changed: 0 additions & 22 deletions
This file was deleted.

config/nginx/in-vhost.conf

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
server {
2+
listen 80 default_server;
3+
server_name _;
4+
5+
server_tokens off;
6+
7+
client_max_body_size 100M;
8+
9+
root /var/www/app/public/;
10+
index index.php;
11+
12+
location / {
13+
try_files $uri $uri/ /index.php?$query_string;
14+
}
15+
16+
location = /favicon.ico { access_log off; log_not_found off; }
17+
location = /robots.txt { access_log off; log_not_found off; }
18+
19+
20+
location ~* /storage/.*\.php$ {
21+
return 503;
22+
}
23+
24+
location ~ \.php$ {
25+
fastcgi_split_path_info ^(.+\.php)(/.+)$;
26+
fastcgi_pass app:9000;
27+
fastcgi_index index.php;
28+
include fastcgi_params;
29+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
30+
fastcgi_intercept_errors off;
31+
fastcgi_buffer_size 16k;
32+
fastcgi_buffers 4 16k;
33+
}
34+
}

config/nginx/invoiceninja.conf

Lines changed: 0 additions & 14 deletions
This file was deleted.

config/nginx/laravel.conf

Lines changed: 0 additions & 32 deletions
This file was deleted.

config/php/php-cli.ini

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
session.auto_start = Off
2+
short_open_tag = Off
3+
4+
error_reporting = E_ALL & ~E_NOTICE & ~E_WARNING & ~E_STRICT & ~E_DEPRECATED
5+
6+
; opcache.enable_cli=1
7+
; opcache.fast_shutdown=1
8+
; opcache.memory_consumption=256
9+
; opcache.interned_strings_buffer=8
10+
; opcache.max_accelerated_files=4000
11+
; opcache.revalidate_freq=60
12+
; # http://symfony.com/doc/current/performance.html
13+
; realpath_cache_size = 4096K
14+
; realpath_cache_ttl = 600
15+
16+
memory_limit = 2G
17+
post_max_size = 60M
18+
upload_max_filesize = 50M

0 commit comments

Comments
 (0)