mirror of
https://github.com/invoiceninja/dockerfiles.git
synced 2025-12-31 19:47:25 +01:00
Compare commits
36 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6a16f6f4de | ||
|
|
68cfe612ee | ||
|
|
ed9c23d9c7 | ||
|
|
f6fa32f606 | ||
|
|
a0454d3998 | ||
|
|
04f4dbe248 | ||
|
|
a7822987b2 | ||
|
|
7b7f3df710 | ||
|
|
a9b3a8a8a4 | ||
|
|
a53b702c45 | ||
|
|
39c546e270 | ||
|
|
9c0e00edb3 | ||
|
|
1f28106e43 | ||
|
|
c4513a868a | ||
|
|
856d47217e | ||
|
|
be0ec204d4 | ||
|
|
9d99120693 | ||
|
|
a5204ccb7d | ||
|
|
995d70ab60 | ||
|
|
11855e0701 | ||
|
|
42816b6282 | ||
|
|
2ad607fa2d | ||
|
|
2c25caf627 | ||
|
|
a2b64d2060 | ||
|
|
b58d4e1259 | ||
|
|
a7683ada33 | ||
|
|
3e8a6c72a7 | ||
|
|
3b0f7c463a | ||
|
|
c00d44380c | ||
|
|
cb4120fc54 | ||
|
|
f2c5a1f842 | ||
|
|
029bc57fac | ||
|
|
d60bf39950 | ||
|
|
31eb278f0d | ||
|
|
44b460bf13 | ||
|
|
7bae300fd2 |
21
.github/workflows/auto-close-issues.yml
vendored
Normal file
21
.github/workflows/auto-close-issues.yml
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
name: Close stale issues after 5 days
|
||||
|
||||
on:
|
||||
schedule:
|
||||
# Run this workflow every day at midnight
|
||||
- cron: '0 0 * * *'
|
||||
|
||||
jobs:
|
||||
close-stale-issues:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Close stale issues
|
||||
uses: actions/stale@v7
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
stale-issue-message: "This issue has been automatically closed due to inactivity for 5 days."
|
||||
days-before-stale: 4 # Number of days before marking an issue as stale
|
||||
days-before-close: 1 # Number of days after being marked stale before closing
|
||||
stale-label: "stale" # Label to add to stale issues
|
||||
exempt-issue-labels: "keep-open,triage,bug" # Prevents issues with this label from being closed
|
||||
only-issues: true # Only affects issues, not pull requests
|
||||
2
.github/workflows/build-image-debian.yaml
vendored
2
.github/workflows/build-image-debian.yaml
vendored
@@ -12,7 +12,7 @@ on:
|
||||
|
||||
jobs:
|
||||
docker:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
2
.github/workflows/publish-image.yaml
vendored
2
.github/workflows/publish-image.yaml
vendored
@@ -7,7 +7,7 @@ on:
|
||||
|
||||
jobs:
|
||||
docker:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-22.04
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
|
||||
12
README.md
12
README.md
@@ -54,7 +54,7 @@ The `APP_KEY` can be generated by running:
|
||||
docker run --rm -it invoiceninja/invoiceninja-debian php artisan key:generate --show
|
||||
|
||||
# Or if your containers are already running:
|
||||
docker-compose exec app php artisan key:generate --show
|
||||
docker compose exec app php artisan key:generate --show
|
||||
```
|
||||
|
||||
Copy the entire string and insert in the .env file at `APP_KEY=base64....`
|
||||
@@ -64,7 +64,7 @@ Copy the entire string and insert in the .env file at `APP_KEY=base64....`
|
||||
Start the container with:
|
||||
|
||||
```bash
|
||||
docker-compose up -d
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
**Note: When performing the setup, the Database host is ```mysql```
|
||||
@@ -74,9 +74,9 @@ docker-compose up -d
|
||||
To upgrade to a newer release image, update your docker-compose.yml first by running:
|
||||
|
||||
```bash
|
||||
docker-compose down
|
||||
docker-compose pull
|
||||
docker-compose up
|
||||
docker compose down
|
||||
docker compose pull
|
||||
docker compose up
|
||||
```
|
||||
|
||||
It is recommended to perform a backup before updating.
|
||||
@@ -92,4 +92,4 @@ This is a new image which should provide much better support for all users, howe
|
||||
|
||||
- [ ] Backup script
|
||||
- [ ] Integrate soketi server
|
||||
- [ ] Add elastic search for site wide search
|
||||
- [ ] Add elastic search for site wide search
|
||||
|
||||
2
debian/.env
vendored
2
debian/.env
vendored
@@ -57,6 +57,6 @@ NORDIGEN_SECRET_KEY=
|
||||
|
||||
IS_DOCKER=true
|
||||
SCOUT_DRIVER=null
|
||||
SNAPPDF_CHROMIUM_PATH=/usr/bin/google-chrome-stable
|
||||
#SNAPPDF_CHROMIUM_PATH=/usr/bin/google-chrome-stable
|
||||
|
||||
|
||||
|
||||
88
debian/Dockerfile
vendored
88
debian/Dockerfile
vendored
@@ -1,7 +1,24 @@
|
||||
FROM php:8.3-fpm AS base
|
||||
ARG PHP=8.3
|
||||
|
||||
ARG php_require="bcmath gd pdo_mysql zip"
|
||||
ARG php_suggest="exif imagick intl pcntl soap saxon-12.5.0"
|
||||
FROM php:${PHP}-fpm AS prepare-app
|
||||
|
||||
USER www-data
|
||||
|
||||
RUN curl -sL "https://github.com/invoiceninja/invoiceninja/releases/latest/download/invoiceninja.tar.gz" | \
|
||||
tar -xz -C /var/www/html \
|
||||
&& ln -s /var/www/html/resources/views/react/index.blade.php /var/www/html/public/index.html \
|
||||
&& php artisan storage:link \
|
||||
# Workaround for application updates
|
||||
&& mv /var/www/html/public /tmp/public
|
||||
|
||||
# ==================
|
||||
# InvoiceNinja image
|
||||
# ==================
|
||||
FROM php:${PHP}-fpm
|
||||
|
||||
# PHP modules
|
||||
ARG php_require="bcmath gd mbstring pdo_mysql zip"
|
||||
ARG php_suggest="exif imagick intl pcntl saxon soap"
|
||||
ARG php_extra="opcache"
|
||||
|
||||
# Install system dependencies
|
||||
@@ -16,15 +33,15 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
xfonts-wqy \
|
||||
# Install google-chrome-stable(amd64)/chromium(arm64)
|
||||
&& if [ "$(dpkg --print-architecture)" = "amd64" ]; then \
|
||||
mkdir -p /etc/apt/keyrings \
|
||||
&& curl -fsSL https://dl.google.com/linux/linux_signing_key.pub | \
|
||||
gpg --dearmor -o /etc/apt/keyrings/google.gpg \
|
||||
&& echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/google.gpg] https://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list \
|
||||
&& apt-get update \
|
||||
&& apt-get install -y --no-install-recommends google-chrome-stable; \
|
||||
mkdir -p /etc/apt/keyrings \
|
||||
&& curl -fsSL https://dl.google.com/linux/linux_signing_key.pub | \
|
||||
gpg --dearmor -o /etc/apt/keyrings/google.gpg \
|
||||
&& echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/google.gpg] https://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list \
|
||||
&& apt-get update \
|
||||
&& apt-get install -y --no-install-recommends google-chrome-stable; \
|
||||
elif [ "$(dpkg --print-architecture)" = "arm64" ]; then \
|
||||
apt-get install -y --no-install-recommends \
|
||||
chromium; \
|
||||
apt-get install -y --no-install-recommends \
|
||||
chromium; \
|
||||
fi \
|
||||
# Create config directory for chromium/google-chrome-stable
|
||||
&& mkdir /var/www/.config \
|
||||
@@ -36,52 +53,33 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
&& 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' ) | sh -s \
|
||||
${php_require} \
|
||||
${php_suggest} \
|
||||
${php_extra} \
|
||||
@composer
|
||||
COPY --from=ghcr.io/mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
|
||||
|
||||
RUN install-php-extensions \
|
||||
${php_require} \
|
||||
${php_suggest} \
|
||||
${php_extra}
|
||||
|
||||
# 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 scripts
|
||||
COPY rootfs /
|
||||
COPY php/php.ini /usr/local/etc/php/conf.d/invoiceninja.ini
|
||||
|
||||
USER www-data
|
||||
|
||||
WORKDIR /var/www/html
|
||||
|
||||
# Setup InvoiceNinja
|
||||
RUN curl -s "https://api.github.com/repos/invoiceninja/invoiceninja/releases/latest" | \
|
||||
grep -o '"browser_download_url": "[^"]*invoiceninja.tar"' | \
|
||||
cut -d '"' -f 4 | \
|
||||
xargs curl -sL | \
|
||||
tar -oxz -C /var/www/html \
|
||||
&& cp /var/www/html/resources/views/react/index.blade.php /var/www/html/public/index.html \
|
||||
# File permissions
|
||||
&& find /var/www/html/ -type f -exec chmod 644 {} \; \
|
||||
# Directory permissions
|
||||
&& find /var/www/html/ -type d -exec chmod 755 {} \; \
|
||||
# Install dependencies
|
||||
&& composer install --no-dev --no-scripts --no-autoloader \
|
||||
&& composer dump-autoload --optimize \
|
||||
&& php artisan optimize \
|
||||
&& php artisan storage:link \
|
||||
# Workaround for application updates
|
||||
&& mv /var/www/html/public /tmp/public
|
||||
|
||||
USER root
|
||||
COPY php/php-fpm.conf /usr/local/etc/php-fpm.d/invoiceninja.conf
|
||||
|
||||
# Setup supervisor
|
||||
COPY supervisor/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
||||
|
||||
# Setup InvoiceNinja
|
||||
COPY --from=prepare-app /var/www/html /var/www/html
|
||||
COPY --from=prepare-app /tmp/public /tmp/public
|
||||
|
||||
# Add initialization script
|
||||
COPY --chmod=0755 scripts/init.sh /usr/local/bin/init.sh
|
||||
|
||||
# Health check
|
||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=30s --retries=3 \
|
||||
CMD php -v || exit 1
|
||||
CMD pgrep -f "php-fpm: master process"
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/init.sh"]
|
||||
CMD ["supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
|
||||
CMD ["supervisord", "-c", "/etc/supervisor/supervisord.conf"]
|
||||
|
||||
9
debian/docker-compose.yml
vendored
9
debian/docker-compose.yml
vendored
@@ -14,10 +14,9 @@ services:
|
||||
- ./.env
|
||||
volumes:
|
||||
- ./.env:/var/www/html/.env
|
||||
- ./php/php.ini:/usr/local/etc/php/conf.d/zzz-php.ini:ro
|
||||
- ./php/php-fpm.conf:/usr/local/etc/php-fpm.d/zzz-php-fpm.conf:ro
|
||||
- ./supervisor/supervisord.conf:/etc/supervisor/conf.d/supervisord.conf:ro
|
||||
- app_cache:/var/www/html/bootstrap/cache
|
||||
# - ./php/php.ini:/usr/local/etc/php/conf.d/invoiceninja.ini:ro
|
||||
# - ./php/php-fpm.conf:/usr/local/etc/php-fpm.d/invoiceninja.conf:ro
|
||||
# - ./supervisor/supervisord.conf:/etc/supervisor/conf.d/supervisord.conf:ro
|
||||
- app_public:/var/www/html/public
|
||||
- app_storage:/var/www/html/storage
|
||||
networks:
|
||||
@@ -84,8 +83,6 @@ networks:
|
||||
driver: bridge
|
||||
|
||||
volumes:
|
||||
app_cache:
|
||||
driver: local
|
||||
app_public:
|
||||
driver: local
|
||||
app_storage:
|
||||
|
||||
22
debian/php/php.ini
vendored
22
debian/php/php.ini
vendored
@@ -1,15 +1,23 @@
|
||||
[core]
|
||||
# https://www.php.net/manual/en/ini.core.php
|
||||
post_max_size = 10M
|
||||
upload_max_filesize = 10M
|
||||
; https://www.php.net/manual/en/ini.core.php
|
||||
post_max_size=10M
|
||||
upload_max_filesize=10M
|
||||
|
||||
[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.max_accelerated_files=4000
|
||||
opcache.revalidate_freq=60
|
||||
|
||||
[jit]
|
||||
# https://wiki.php.net/rfc/jit_config_defaults
|
||||
; https://wiki.php.net/rfc/jit_config_defaults
|
||||
opcache.jit=tracing
|
||||
opcache.jit_buffer_size=64M
|
||||
|
||||
[extra]
|
||||
; http://symfony.com/doc/current/performance.html
|
||||
opcache.memory_consumption=256
|
||||
opcache.max_accelerated_files=20000
|
||||
opcache.preload=/var/www/html/preload.php
|
||||
opcache.preload_user=www-data
|
||||
opcache.validate_timestamps=0
|
||||
realpath_cache_size = 4096K
|
||||
realpath_cache_ttl = 600
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
php artisan db:seed --force
|
||||
|
||||
# Build up array of arguments...
|
||||
if [ ! -z "${IN_USER_EMAIL}" ]; then
|
||||
email="--email ${IN_USER_EMAIL}"
|
||||
fi
|
||||
|
||||
if [ ! -z "${IN_PASSWORD}" ]; then
|
||||
password="--password ${IN_PASSWORD}"
|
||||
fi
|
||||
|
||||
php artisan ninja:create-account $email $password
|
||||
60
debian/scripts/init.sh
vendored
60
debian/scripts/init.sh
vendored
@@ -1,35 +1,19 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
#!/bin/sh -eu
|
||||
|
||||
in_log() {
|
||||
local type="$1"
|
||||
shift
|
||||
printf '%s [%s] [Entrypoint]: %s\n' "$(date -u '+%Y-%m-%dT%H:%M:%SZ')" "$type" "$*"
|
||||
}
|
||||
# Set PDF generation browser path based on architecture
|
||||
if [ "$(dpkg --print-architecture)" = "amd64" ]; then
|
||||
export SNAPPDF_CHROMIUM_PATH=/usr/bin/google-chrome-stable
|
||||
elif [ "$(dpkg --print-architecture)" = "arm64" ]; then
|
||||
export SNAPPDF_CHROMIUM_PATH=/usr/bin/chromium
|
||||
fi
|
||||
|
||||
docker_process_init_files() {
|
||||
echo
|
||||
local f
|
||||
for f; do
|
||||
case "$f" in
|
||||
*.sh)
|
||||
# https://github.com/docker-library/postgres/issues/450#issuecomment-393167936
|
||||
# https://github.com/docker-library/postgres/pull/452
|
||||
if [ -x "$f" ]; then
|
||||
in_log INFO "$0: running $f"
|
||||
"$f"
|
||||
else
|
||||
in_log INFO "$0: sourcing $f"
|
||||
. "$f"
|
||||
fi
|
||||
;;
|
||||
*) in_log INFO "$0: ignoring $f" ;;
|
||||
esac
|
||||
echo
|
||||
done
|
||||
}
|
||||
if [ "$*" = 'supervisord -c /etc/supervisor/supervisord.conf' ]; then
|
||||
|
||||
# Check for required folders and create if needed
|
||||
[ -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 [ "$*" = 'supervisord -c /etc/supervisor/conf.d/supervisord.conf' ]; then
|
||||
# Workaround for application updates
|
||||
if [ "$(ls -A /tmp/public)" ]; then
|
||||
echo "Updating public folder..."
|
||||
@@ -61,18 +45,20 @@ if [ "$*" = 'supervisord -c /etc/supervisor/conf.d/supervisord.conf' ]; then
|
||||
runuser -u www-data -- php artisan migrate --force
|
||||
|
||||
# If first IN run, it needs to be initialized
|
||||
echo "Checking initialization status..."
|
||||
IN_INIT=$(php artisan tinker --execute='echo Schema::hasTable("accounts") && !App\Models\Account::all()->first();')
|
||||
echo "IN_INIT value: $IN_INIT"
|
||||
if [ "$(php -d opcache.preload='' artisan tinker --execute='echo Schema::hasTable("accounts") && !App\Models\Account::all()->first();')" = "1" ]; then
|
||||
echo "Running initialization..."
|
||||
|
||||
if [ "$IN_INIT" = "1" ]; then
|
||||
echo "Running initialization scripts..."
|
||||
docker_process_init_files /docker-entrypoint-init.d/*
|
||||
php artisan db:seed --force
|
||||
|
||||
if [ -n "${IN_USER_EMAIL}" ] && [ -n "${IN_PASSWORD}" ]; then
|
||||
php artisan ninja:create-account --email "${IN_USER_EMAIL}" --password "${IN_PASSWORD}"
|
||||
else
|
||||
echo "Initialization failed - Set IN_USER_EMAIL and IN_PASSWORD in .env"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Production setup completed"
|
||||
echo "IN_INIT value: $IN_INIT"
|
||||
|
||||
fi
|
||||
|
||||
echo "Starting supervisord..."
|
||||
|
||||
32
debian/supervisor/supervisord.conf
vendored
32
debian/supervisor/supervisord.conf
vendored
@@ -1,32 +1,22 @@
|
||||
[unix_http_server]
|
||||
file=/var/run/supervisor.sock
|
||||
chmod=0700
|
||||
|
||||
[supervisord]
|
||||
nodaemon=true
|
||||
user=root
|
||||
logfile=/var/log/supervisor/supervisord.log
|
||||
logfile=/dev/null
|
||||
logfile_maxbytes=0
|
||||
pidfile=/var/run/supervisord.pid
|
||||
|
||||
[rpcinterface:supervisor]
|
||||
supervisor.rpcinterface_factory=supervisor.rpcinterface:make_main_rpcinterface
|
||||
|
||||
[supervisorctl]
|
||||
serverurl=unix:///var/run/supervisor.sock
|
||||
|
||||
[program:php-fpm]
|
||||
command=/usr/local/sbin/php-fpm -F
|
||||
autostart=true
|
||||
autorestart=true
|
||||
priority=5
|
||||
stdout_logfile=/dev/stdout
|
||||
stdout_logfile=/dev/fd/1
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/dev/stderr
|
||||
stderr_logfile_maxbytes=0
|
||||
redirect_stderr=true
|
||||
|
||||
[program:queue-worker]
|
||||
process_name=%(program_name)s_%(process_num)02d
|
||||
command=php /var/www/html/artisan queue:work --sleep=3 --tries=3 --max-time=3600
|
||||
command=php /var/www/html/artisan queue:work --sleep=3 --tries=3 --max-time=3600 --verbose
|
||||
autostart=true
|
||||
autorestart=true
|
||||
stopasgroup=true
|
||||
@@ -34,16 +24,16 @@ killasgroup=true
|
||||
user=www-data
|
||||
numprocs=2
|
||||
environment=HOME="/var/www"
|
||||
stdout_logfile=/var/log/php-worker.log
|
||||
stderr_logfile=/var/log/php-worker.err.log
|
||||
stdout_logfile=/dev/fd/1
|
||||
stdout_logfile_maxbytes=0
|
||||
redirect_stderr=true
|
||||
stopwaitsecs=3600
|
||||
|
||||
[program:scheduler]
|
||||
command=/bin/sh -c "while [ true ]; do (php /var/www/html/artisan schedule:run --verbose --no-interaction &); sleep 60; done"
|
||||
command=php /var/www/html/artisan schedule:work --verbose
|
||||
autostart=true
|
||||
autorestart=true
|
||||
user=www-data
|
||||
stdout_logfile=/dev/stdout
|
||||
stdout_logfile=/dev/fd/1
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/dev/stderr
|
||||
stderr_logfile_maxbytes=0
|
||||
redirect_stderr=true
|
||||
|
||||
Reference in New Issue
Block a user