mirror of
https://github.com/invoiceninja/dockerfiles.git
synced 2026-01-27 17:27:12 +01:00
Compare commits
40 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f80e7f2ec3 | ||
|
|
f5821630fa | ||
|
|
1848f11a36 | ||
|
|
f96d4d4aa0 | ||
|
|
5d29d3a052 | ||
|
|
0c607953ec | ||
|
|
ebc6c3642a | ||
|
|
ec35498159 | ||
|
|
4bff59808e | ||
|
|
217c05bd1f | ||
|
|
24d1f9cd2e | ||
|
|
9a3603b709 | ||
|
|
c2bf3ca8d9 | ||
|
|
1c3f96e723 | ||
|
|
2364f53777 | ||
|
|
7bfbe9ee03 | ||
|
|
afd597456f | ||
|
|
243f46bd23 | ||
|
|
6dfaa3b441 | ||
|
|
6d0e0648e3 | ||
|
|
85979fdcf2 | ||
|
|
377c068667 | ||
|
|
da7f8d93b0 | ||
|
|
1d475a5218 | ||
|
|
3a8184df73 | ||
|
|
0c796fee5f | ||
|
|
bc5aa2e844 | ||
|
|
295bb6268b | ||
|
|
ff636077d4 | ||
|
|
247f946422 | ||
|
|
4c50bbad19 | ||
|
|
2e22177b20 | ||
|
|
dfc392580e | ||
|
|
260980f2a3 | ||
|
|
57724b7d93 | ||
|
|
39b6680f0b | ||
|
|
768df3c1dd | ||
|
|
7870b345ed | ||
|
|
3c6ed5cda1 | ||
|
|
2f43d4b45a |
4
.github/workflows/build-image-debian.yaml
vendored
4
.github/workflows/build-image-debian.yaml
vendored
@@ -1,4 +1,4 @@
|
|||||||
name: Build Debian OctaneContainer Image
|
name: Build Debian Octane Container Image
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
@@ -12,7 +12,7 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
docker:
|
docker:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-22.04
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|||||||
6
.github/workflows/publish-image.yaml
vendored
6
.github/workflows/publish-image.yaml
vendored
@@ -7,16 +7,16 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
docker:
|
docker:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-22.04
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- image: invoiceninja/invoiceninja-octane
|
- image: invoiceninja/invoiceninja-octane
|
||||||
context: ./debian
|
context: debian
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4 # Updated from v2
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
|
|||||||
2
debian/.env
vendored
2
debian/.env
vendored
@@ -57,6 +57,6 @@ NORDIGEN_SECRET_KEY=
|
|||||||
|
|
||||||
IS_DOCKER=true
|
IS_DOCKER=true
|
||||||
SCOUT_DRIVER=null
|
SCOUT_DRIVER=null
|
||||||
SNAPPDF_CHROMIUM_PATH=/usr/bin/google-chrome-stable
|
#SNAPPDF_CHROMIUM_PATH=/usr/bin/google-chrome-stable
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
55
debian/Dockerfile
vendored
55
debian/Dockerfile
vendored
@@ -1,38 +1,27 @@
|
|||||||
FROM composer:latest AS composer
|
ARG PHP_VERSION=8.3
|
||||||
|
ARG FRANKENPHP_VERSION=1
|
||||||
|
ARG DEBIAN_VERSION=bookworm
|
||||||
|
|
||||||
RUN curl -s "https://api.github.com/repos/invoiceninja/invoiceninja/releases/latest" | \
|
FROM dunglas/frankenphp:${FRANKENPHP_VERSION}-php${PHP_VERSION}-${DEBIAN_VERSION} AS prepare-app
|
||||||
grep -o '"browser_download_url": "[^"]*invoiceninja.tar"' | \
|
|
||||||
cut -d '"' -f 4 | \
|
|
||||||
xargs curl -sL | \
|
|
||||||
tar -xz
|
|
||||||
|
|
||||||
RUN ln -s ./resources/views/react/index.blade.php ./public/index.html
|
RUN curl -sL "https://github.com/invoiceninja/invoiceninja/releases/latest/download/invoiceninja.tar.gz" | \
|
||||||
|
tar -xz \
|
||||||
# Set permissions: directories 755, files 644
|
&& ln -s ./resources/views/react/index.blade.php ./public/index.html \
|
||||||
RUN chmod -R a=r,u+w,a+X .
|
# Symlink
|
||||||
|
&& php artisan storage:link \
|
||||||
# Install dependencies
|
# Octane
|
||||||
RUN composer install --no-dev --no-scripts --no-autoloader --ignore-platform-reqs
|
&& php artisan octane:install --server=frankenphp
|
||||||
|
|
||||||
RUN composer require laravel/octane --ignore-platform-reqs
|
|
||||||
|
|
||||||
RUN composer dump-autoload --optimize
|
|
||||||
|
|
||||||
RUN php artisan storage:link
|
|
||||||
|
|
||||||
# Octane
|
|
||||||
RUN php artisan octane:install --server=frankenphp
|
|
||||||
|
|
||||||
# ==================
|
# ==================
|
||||||
# InvoiceNinja image
|
# InvoiceNinja image
|
||||||
# ==================
|
# ==================
|
||||||
FROM dunglas/frankenphp:1-php8.3-bookworm
|
FROM dunglas/frankenphp:${FRANKENPHP_VERSION}-php${PHP_VERSION}-${DEBIAN_VERSION}
|
||||||
|
|
||||||
ARG user=ninja
|
ARG user=ninja
|
||||||
|
|
||||||
# PHP modules
|
# PHP modules
|
||||||
ARG php_require="bcmath gd pdo_mysql zip"
|
ARG php_require="bcmath gd mbstring pdo_mysql zip"
|
||||||
ARG php_suggest="exif imagick intl pcntl soap saxon-12.5.0"
|
ARG php_suggest="exif imagick intl pcntl saxon soap"
|
||||||
ARG php_extra="opcache"
|
ARG php_extra="opcache"
|
||||||
|
|
||||||
# Create a system user UID/GID=999
|
# Create a system user UID/GID=999
|
||||||
@@ -79,7 +68,9 @@ RUN install-php-extensions \
|
|||||||
${php_extra}
|
${php_extra}
|
||||||
|
|
||||||
# Configure PHP
|
# Configure PHP
|
||||||
RUN mv "${PHP_INI_DIR}/php.ini-production" "${PHP_INI_DIR}/php.ini"
|
RUN ln -s "${PHP_INI_DIR}/php.ini-production" "${PHP_INI_DIR}/php.ini"
|
||||||
|
|
||||||
|
COPY php/php.ini /usr/local/etc/php/conf.d/invoiceninja.ini
|
||||||
|
|
||||||
# Create directory for artisan tinker (init.sh)
|
# Create directory for artisan tinker (init.sh)
|
||||||
RUN mkdir /config/psysh \
|
RUN mkdir /config/psysh \
|
||||||
@@ -90,14 +81,16 @@ RUN chown -R ${user}: \
|
|||||||
/data/caddy \
|
/data/caddy \
|
||||||
/config/caddy
|
/config/caddy
|
||||||
|
|
||||||
ENTRYPOINT ["/usr/local/bin/init.sh"]
|
|
||||||
|
|
||||||
CMD ["frankenphp", "php-cli", "artisan", "octane:frankenphp"]
|
|
||||||
|
|
||||||
# InvoiceNinja
|
# InvoiceNinja
|
||||||
COPY --from=composer --chown=${user}:${user} /app /app
|
COPY --from=prepare-app --chown=${user}:${user} /app /app
|
||||||
|
|
||||||
# Add initialization script
|
# Add initialization script
|
||||||
COPY --chmod=0755 scripts/init.sh /usr/local/bin/init.sh
|
COPY --chmod=0755 scripts/init.sh /usr/local/bin/init.sh
|
||||||
|
|
||||||
USER ${user}
|
USER ${user}
|
||||||
|
|
||||||
|
HEALTHCHECK --start-period=10s CMD curl -f http://localhost/health
|
||||||
|
|
||||||
|
ENTRYPOINT ["/usr/local/bin/init.sh"]
|
||||||
|
|
||||||
|
CMD ["frankenphp", "php-cli", "artisan", "octane:frankenphp"]
|
||||||
|
|||||||
27
debian/docker-compose.yml
vendored
27
debian/docker-compose.yml
vendored
@@ -9,9 +9,8 @@ x-logging: &default-logging
|
|||||||
x-app-volumes: &volumes
|
x-app-volumes: &volumes
|
||||||
volumes:
|
volumes:
|
||||||
- ./.env:/app/.env
|
- ./.env:/app/.env
|
||||||
- ./php/php.ini:/usr/local/etc/php/conf.d/zzz-php.ini:ro
|
|
||||||
- app_cache:/var/www/html/bootstrap/cache
|
|
||||||
- app_storage:/app/storage
|
- app_storage:/app/storage
|
||||||
|
- caddy_data:/data
|
||||||
|
|
||||||
services:
|
services:
|
||||||
app:
|
app:
|
||||||
@@ -20,17 +19,17 @@ services:
|
|||||||
image: invoiceninja/invoiceninja-debian:${TAG:-latest}
|
image: invoiceninja/invoiceninja-debian:${TAG:-latest}
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
# php artisan help octane:frankenphp
|
# php artisan help octane:frankenphp
|
||||||
command: --log-level=info
|
command: --port=80 --workers=2 --log-level=info
|
||||||
|
# command: --host=example.com --port=443 --workers=2 --https --http-redirect --log-level=info
|
||||||
ports:
|
ports:
|
||||||
- "80:8000"
|
- "80:80" # HTTP
|
||||||
|
# - "443:443" # HTTPS
|
||||||
|
# - "443:443/udp" # HTTP/3, Works for chromium based browser, but causes H3_GENERAL_PROTOCOL_ERROR for pdf previews in Firefox
|
||||||
env_file:
|
env_file:
|
||||||
- ./.env
|
- ./.env
|
||||||
environment:
|
environment:
|
||||||
LARAVEL_ROLE: app
|
LARAVEL_ROLE: app
|
||||||
<<: *volumes
|
<<: *volumes
|
||||||
# HEALTHCHECK from frankenphp image
|
|
||||||
healthcheck:
|
|
||||||
start_period: 180s
|
|
||||||
depends_on:
|
depends_on:
|
||||||
mysql:
|
mysql:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
@@ -55,6 +54,9 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
LARAVEL_ROLE: worker
|
LARAVEL_ROLE: worker
|
||||||
<<: *volumes
|
<<: *volumes
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "pgrep", "-f", "queue:work"]
|
||||||
|
start_period: 10s
|
||||||
depends_on:
|
depends_on:
|
||||||
app:
|
app:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
@@ -70,6 +72,9 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
LARAVEL_ROLE: scheduler
|
LARAVEL_ROLE: scheduler
|
||||||
<<: *volumes
|
<<: *volumes
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "pgrep", "-f", "schedule:work"]
|
||||||
|
start_period: 10s
|
||||||
depends_on:
|
depends_on:
|
||||||
app:
|
app:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
@@ -134,15 +139,9 @@ services:
|
|||||||
# logging: *default-logging
|
# logging: *default-logging
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
app_cache:
|
|
||||||
driver: local
|
|
||||||
app_storage:
|
app_storage:
|
||||||
driver: local
|
caddy_data:
|
||||||
mysql_data:
|
mysql_data:
|
||||||
driver: local
|
|
||||||
redis_data:
|
redis_data:
|
||||||
driver: local
|
|
||||||
# mariadb:
|
# mariadb:
|
||||||
# driver: local
|
|
||||||
# valkey:
|
# valkey:
|
||||||
# driver: local
|
|
||||||
|
|||||||
22
debian/php/php.ini
vendored
22
debian/php/php.ini
vendored
@@ -1,15 +1,23 @@
|
|||||||
[core]
|
[core]
|
||||||
# https://www.php.net/manual/en/ini.core.php
|
; https://www.php.net/manual/en/ini.core.php
|
||||||
post_max_size = 10M
|
post_max_size=10M
|
||||||
upload_max_filesize = 10M
|
upload_max_filesize=10M
|
||||||
|
|
||||||
[opcache]
|
[opcache]
|
||||||
# https://www.php.net/manual/en/opcache.installation.php#opcache.installation.recommended
|
; https://www.php.net/manual/en/opcache.installation.php#opcache.installation.recommended
|
||||||
opcache.enable_cli=1
|
opcache.enable_cli=1
|
||||||
opcache.max_accelerated_files=4000
|
|
||||||
opcache.revalidate_freq=60
|
|
||||||
|
|
||||||
[jit]
|
[jit]
|
||||||
# https://wiki.php.net/rfc/jit_config_defaults
|
; https://wiki.php.net/rfc/jit_config_defaults
|
||||||
opcache.jit=tracing
|
opcache.jit=tracing
|
||||||
opcache.jit_buffer_size=64M
|
opcache.jit_buffer_size=64M
|
||||||
|
|
||||||
|
[extra]
|
||||||
|
; https://frankenphp.dev/docs/performance/#php-performance
|
||||||
|
; http://symfony.com/doc/current/performance.html
|
||||||
|
opcache.memory_consumption=256
|
||||||
|
opcache.max_accelerated_files=20000
|
||||||
|
opcache.preload=/app/preload.php
|
||||||
|
opcache.validate_timestamps=0
|
||||||
|
realpath_cache_size = 4096K
|
||||||
|
realpath_cache_ttl = 600
|
||||||
|
|||||||
40
debian/scripts/init.sh
vendored
40
debian/scripts/init.sh
vendored
@@ -3,13 +3,53 @@
|
|||||||
# Fallback to app
|
# Fallback to app
|
||||||
role=${LARAVEL_ROLE:-app}
|
role=${LARAVEL_ROLE:-app}
|
||||||
|
|
||||||
|
# Set PDF generation browser path based on architecture
|
||||||
|
export SNAPPDF_CHROMIUM_PATH=/usr/bin/google-chrome-stable
|
||||||
|
if [ "$(dpkg --print-architecture)" = "arm64" ]; then
|
||||||
|
export SNAPPDF_CHROMIUM_PATH=/usr/bin/chromium
|
||||||
|
fi
|
||||||
|
|
||||||
# Check for default CMD, flag(s) or empty CMD
|
# Check for default CMD, flag(s) or empty CMD
|
||||||
if [ "$*" = 'frankenphp php-cli artisan octane:frankenphp' ] || [ "${1#-}" != "$1" ] || [ "$#" -eq "0" ]; then
|
if [ "$*" = 'frankenphp php-cli artisan octane:frankenphp' ] || [ "${1#-}" != "$1" ] || [ "$#" -eq "0" ]; then
|
||||||
|
|
||||||
|
if [ "--help" = "$1" ]; then
|
||||||
|
echo [CMD]
|
||||||
|
echo "This image will execute specific CMDs based on the environment variable LARAVEL_ROLE"
|
||||||
|
echo
|
||||||
|
echo "LARAVEL_ROLE=app: frankenphp php-cli artisan octane:frankenphp (default)"
|
||||||
|
echo "LARAVEL_ROLE=worker: frankenphp php-cli artisan queue:work"
|
||||||
|
echo "LARAVEL_ROLE=scheduler: frankenphp php-cli artisan schedule:work"
|
||||||
|
echo
|
||||||
|
echo [FLAGS]
|
||||||
|
echo To the CMD defined by LARAVEL_ROLE can be extended with flags for artisan commands
|
||||||
|
echo
|
||||||
|
echo Available flags can be displaced:
|
||||||
|
echo docker run --rm invoiceninja/invoiceninja-debian frankenphp php-cli artisan help octane:frankenphp
|
||||||
|
echo docker run --rm invoiceninja/invoiceninja-debian frankenphp php-cli artisan queue:work
|
||||||
|
echo docker run --rm invoiceninja/invoiceninja-debian frankenphp php-cli artisan schedule:work
|
||||||
|
echo
|
||||||
|
echo Example:
|
||||||
|
echo docker run -e LARAVEL_ROLE=worker invoiceninja/invoiceninja-debian --verbose --sleep=3 --tries=3 --max-time=3600
|
||||||
|
echo
|
||||||
|
echo [Deployment]
|
||||||
|
echo Docker compose is recommended
|
||||||
|
echo
|
||||||
|
echo Example:
|
||||||
|
echo https://github.com/invoiceninja/dockerfiles/blob/octane/debian/docker-compose.yml
|
||||||
|
echo
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
# Run app
|
# Run app
|
||||||
if [ "${role}" = "app" ]; then
|
if [ "${role}" = "app" ]; then
|
||||||
cmd="frankenphp php-cli artisan octane:frankenphp"
|
cmd="frankenphp php-cli artisan octane:frankenphp"
|
||||||
|
|
||||||
|
# Check for required folders and create if needed, relevant for bind mounts
|
||||||
|
# It is not possible to chown, as we are not executing this script as root
|
||||||
|
[ -d /var/www/html/storage/framework/sessions ] || mkdir -p /var/www/html/storage/framework/sessions
|
||||||
|
[ -d /var/www/html/storage/framework/views ] || mkdir -p /var/www/html/storage/framework/views
|
||||||
|
[ -d /var/www/html/storage/framework/cache ] || mkdir -p /var/www/html/storage/framework/cache
|
||||||
|
|
||||||
if [ "$APP_ENV" = "production" ]; then
|
if [ "$APP_ENV" = "production" ]; then
|
||||||
frankenphp php-cli artisan optimize
|
frankenphp php-cli artisan optimize
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user