forked from invoiceninja/dockerfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
110 lines (87 loc) · 3.3 KB
/
Dockerfile
File metadata and controls
110 lines (87 loc) · 3.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
ARG PHP_VERSION=8.5
ARG FRANKENPHP_VERSION=1
ARG DEBIAN_VERSION=trixie
FROM dunglas/frankenphp:${FRANKENPHP_VERSION}-php${PHP_VERSION}-${DEBIAN_VERSION} AS prepare-app
ARG URL=https://github.com/invoiceninja/invoiceninja/releases/latest/download/invoiceninja.tar.gz
ADD ${URL} /tmp/invoiceninja.tar.gz
RUN tar -xf /tmp/invoiceninja.tar.gz \
&& ln -s ./resources/views/react/index.blade.php ./public/index.html \
# Symlink
&& php artisan storage:link \
# Octane
&& php artisan octane:install --server=frankenphp
# ==================
# InvoiceNinja image
# ==================
FROM dunglas/frankenphp:${FRANKENPHP_VERSION}-php${PHP_VERSION}-${DEBIAN_VERSION} AS base
ARG user=ninja
# PHP modules
ARG php_require="bcmath gd mbstring pdo_mysql zip"
ARG php_suggest="exif imagick intl pcntl saxon soap"
ARG php_extra="opcache"
ARG saxon_edition="HE"
# Create a system user UID/GID=999
RUN groupadd -g 999 ${user} && \
useradd -u 999 -g ${user} -r ${user}
# Allow to bind to privileged ports
RUN setcap CAP_NET_BIND_SERVICE=+eip /usr/local/bin/frankenphp
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
chromium \
mariadb-client \
# Unicode support for PDF
fonts-noto-cjk-extra \
fonts-wqy-microhei \
fonts-wqy-zenhei \
xfonts-wqy \
# Create config directory for chromium
&& mkdir /config/chromium \
&& chown ${user}: /config/chromium \
# Cleanup
&& apt-get autoremove -y \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Install PHP extensions
RUN ( curl -sSLf https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions -o - || echo 'return 1' ) | IPE_SAXON_EDITION=${saxon_edition} sh -s \
${php_require} \
${php_suggest} \
${php_extra}
# Configure PHP
RUN ln -s "${PHP_INI_DIR}/php.ini-production" "${PHP_INI_DIR}/php.ini"
COPY ./php.ini /usr/local/etc/php/conf.d/invoiceninja.ini
# Create directory for artisan tinker (init.sh)
RUN mkdir /config/psysh \
&& chown ${user}: /config/psysh
# Change owner for caddy directories
RUN chown -R ${user}: \
/data/caddy \
/config/caddy
# InvoiceNinja
COPY --from=prepare-app --chown=${user}:${user} /app /app
# Add initialization script
COPY --chmod=0755 ./entrypoint.sh /usr/local/bin/entrypoint.sh
ENV FILESYSTEM_DISK=debian_docker
ENV IS_DOCKER=true
ENV SNAPPDF_CHROMIUM_PATH=/usr/bin/chromium
ENTRYPOINT ["entrypoint.sh"]
FROM base AS aio
ENV LARAVEL_ROLE=aio
HEALTHCHECK --start-period=100s CMD curl -f http://localhost/health || exit 1
RUN apt-get update && apt-get install -y --no-install-recommends supervisor && rm -rf /var/lib/apt/lists/*
COPY ./supervisord.conf /etc/supervisor/conf.d/supervisord.conf
CMD ["supervisord", "-c", "/etc/supervisor/supervisord.conf"]
FROM base AS app
ENV LARAVEL_ROLE=app
USER ${user}
HEALTHCHECK --start-period=100s CMD curl -f http://localhost/health || exit 1
CMD ["php", "artisan", "octane:frankenphp"]
FROM base AS scheduler
ENV LARAVEL_ROLE=scheduler
USER ${user}
HEALTHCHECK --start-period=10s CMD pgrep -f schedule:work || exit 1
CMD ["php", "artisan", "schedule:work", "--no-interaction"]
FROM base AS worker
ENV LARAVEL_ROLE=worker
USER ${user}
HEALTHCHECK --start-period=10s CMD pgrep -f queue:work || exit 1
CMD ["php", "artisan", "queue:work", "--no-interaction"]