mirror of
https://github.com/invoiceninja/dockerfiles.git
synced 2026-01-28 01:37:12 +01:00
Compare commits
36 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7238c8fab4 | ||
|
|
6e24faee43 | ||
|
|
1895f822f5 | ||
|
|
7a985b4d0d | ||
|
|
6c8a692c5e | ||
|
|
91a2a106e0 | ||
|
|
7bd0a56260 | ||
|
|
32e59e289b | ||
|
|
bafea492a9 | ||
|
|
9a56657aa4 | ||
|
|
f36968c788 | ||
|
|
ee060b45fd | ||
|
|
430955d43f | ||
|
|
abc66d2491 | ||
|
|
d75b8e3616 | ||
|
|
085df042c1 | ||
|
|
b67f49b9ba | ||
|
|
d1621f0fe5 | ||
|
|
61728ec89b | ||
|
|
1bda3e5809 | ||
|
|
6a16f6f4de | ||
|
|
68cfe612ee | ||
|
|
ed9c23d9c7 | ||
|
|
f6fa32f606 | ||
|
|
a0454d3998 | ||
|
|
04f4dbe248 | ||
|
|
a7822987b2 | ||
|
|
7b7f3df710 | ||
|
|
a9b3a8a8a4 | ||
|
|
a53b702c45 | ||
|
|
39c546e270 | ||
|
|
9c0e00edb3 | ||
|
|
1f28106e43 | ||
|
|
c4513a868a | ||
|
|
856d47217e | ||
|
|
be0ec204d4 |
16
.github/workflows/build-image-debian.yaml
vendored
16
.github/workflows/build-image-debian.yaml
vendored
@@ -12,15 +12,14 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
docker:
|
docker:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ${{ startsWith(matrix.platforms, 'linux/arm') && 'ubuntu-24.04-arm' || 'ubuntu-latest' }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
platform: ["linux/amd64", "linux/arm64"]
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v5
|
||||||
|
|
||||||
- name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v3
|
|
||||||
with:
|
|
||||||
platforms: all
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
id: buildx
|
id: buildx
|
||||||
@@ -28,10 +27,9 @@ jobs:
|
|||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
id: docker_build
|
id: docker_build
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: debian
|
context: debian
|
||||||
file: debian/Dockerfile
|
|
||||||
load: true
|
load: true
|
||||||
tags: invoiceninja/invoiceninja-debian:test
|
tags: invoiceninja/invoiceninja-debian:test
|
||||||
cache-from: type=gha
|
cache-from: type=gha
|
||||||
|
|||||||
24
.github/workflows/publish-image.yaml
vendored
24
.github/workflows/publish-image.yaml
vendored
@@ -7,16 +7,18 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
docker:
|
docker:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ${{ startsWith(matrix.platforms, 'linux/arm') && 'ubuntu-24.04-arm' || 'ubuntu-latest' }}
|
||||||
strategy:
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
|
platform: ["linux/amd64", "linux/arm64"]
|
||||||
include:
|
include:
|
||||||
- image: invoiceninja/invoiceninja-debian
|
- image: invoiceninja/invoiceninja-debian
|
||||||
context: ./debian
|
context: debian
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4 # Updated from v2
|
uses: actions/checkout@v5
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
@@ -43,33 +45,27 @@ jobs:
|
|||||||
echo "version=${VERSION}" >> $GITHUB_OUTPUT
|
echo "version=${VERSION}" >> $GITHUB_OUTPUT
|
||||||
echo "major=${MAJOR}" >> $GITHUB_OUTPUT
|
echo "major=${MAJOR}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v3 # Updated from v1
|
|
||||||
with:
|
|
||||||
platforms: all
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
id: buildx
|
id: buildx
|
||||||
uses: docker/setup-buildx-action@v3 # Updated from v1
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
- name: Login to DockerHub
|
- name: Login to DockerHub
|
||||||
if: github.event_name != 'pull_request'
|
if: github.event_name != 'pull_request'
|
||||||
uses: docker/login-action@v3 # Updated from v1
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||||
|
|
||||||
- name: Build and push
|
- name: Build and push
|
||||||
id: docker_build
|
id: docker_build
|
||||||
uses: docker/build-push-action@v5 # Updated from v2
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: ${{ matrix.context }}
|
context: ${{ matrix.context }}
|
||||||
build-args: INVOICENINJA_VERSION=${{ steps.prep.outputs.version }}
|
build-args: INVOICENINJA_VERSION=${{ steps.prep.outputs.version }}
|
||||||
platforms: linux/amd64,linux/arm64
|
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
tags: ${{ steps.prep.outputs.tags }}
|
tags: ${{ steps.prep.outputs.tags }}
|
||||||
cache-from: type=gha # Updated cache type
|
cache-from: type=gha
|
||||||
cache-to: type=gha,mode=max
|
cache-to: type=gha,mode=max
|
||||||
|
|
||||||
- name: Image digest
|
- name: Image digest
|
||||||
run: echo ${{ steps.docker_build.outputs.digest }}
|
run: echo ${{ steps.docker_build.outputs.digest }}
|
||||||
|
|||||||
11
README.md
11
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
|
docker run --rm -it invoiceninja/invoiceninja-debian php artisan key:generate --show
|
||||||
|
|
||||||
# Or if your containers are already running:
|
# 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....`
|
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:
|
Start the container with:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker-compose up -d
|
docker compose up -d
|
||||||
```
|
```
|
||||||
|
|
||||||
**Note: When performing the setup, the Database host is ```mysql```
|
**Note: When performing the setup, the Database host is ```mysql```
|
||||||
@@ -74,9 +74,8 @@ docker-compose up -d
|
|||||||
To upgrade to a newer release image, update your docker-compose.yml first by running:
|
To upgrade to a newer release image, update your docker-compose.yml first by running:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker-compose down
|
docker compose pull
|
||||||
docker-compose pull
|
docker compose up -d
|
||||||
docker-compose up
|
|
||||||
```
|
```
|
||||||
|
|
||||||
It is recommended to perform a backup before updating.
|
It is recommended to perform a backup before updating.
|
||||||
@@ -92,4 +91,4 @@ This is a new image which should provide much better support for all users, howe
|
|||||||
|
|
||||||
- [ ] Backup script
|
- [ ] Backup script
|
||||||
- [ ] Integrate soketi server
|
- [ ] 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
|
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
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
27
debian/Dockerfile
vendored
27
debian/Dockerfile
vendored
@@ -1,16 +1,13 @@
|
|||||||
ARG PHP=8.3
|
ARG PHP=8.4
|
||||||
|
|
||||||
FROM php:${PHP}-fpm AS prepare-app
|
FROM php:${PHP}-fpm AS prepare-app
|
||||||
|
|
||||||
USER www-data
|
USER www-data
|
||||||
|
|
||||||
RUN curl -s "https://api.github.com/repos/invoiceninja/invoiceninja/releases/latest" | \
|
RUN curl -sL "https://github.com/invoiceninja/invoiceninja/releases/latest/download/invoiceninja.tar.gz" | \
|
||||||
grep -o '"browser_download_url": "[^"]*invoiceninja.tar.gz"' | \
|
tar -xz -C /var/www/html \
|
||||||
cut -d '"' -f 4 | \
|
|
||||||
xargs curl -sL | \
|
|
||||||
tar -xz --strip-components=1 -C /var/www/html \
|
|
||||||
&& ln -s /var/www/html/resources/views/react/index.blade.php /var/www/html/public/index.html \
|
&& ln -s /var/www/html/resources/views/react/index.blade.php /var/www/html/public/index.html \
|
||||||
&& php -d opcache.preload='' artisan storage:link \
|
&& php artisan storage:link \
|
||||||
# Workaround for application updates
|
# Workaround for application updates
|
||||||
&& mv /var/www/html/public /tmp/public
|
&& mv /var/www/html/public /tmp/public
|
||||||
|
|
||||||
@@ -20,12 +17,13 @@ RUN curl -s "https://api.github.com/repos/invoiceninja/invoiceninja/releases/lat
|
|||||||
FROM php:${PHP}-fpm
|
FROM php:${PHP}-fpm
|
||||||
|
|
||||||
# PHP modules
|
# PHP modules
|
||||||
ARG php_require="bcmath gd pdo_mysql zip mbstring"
|
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"
|
||||||
|
|
||||||
# Install system dependencies
|
# Install system dependencies
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
|
libfcgi-bin \
|
||||||
mariadb-client \
|
mariadb-client \
|
||||||
gpg \
|
gpg \
|
||||||
supervisor \
|
supervisor \
|
||||||
@@ -44,7 +42,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||||||
&& apt-get install -y --no-install-recommends google-chrome-stable; \
|
&& apt-get install -y --no-install-recommends google-chrome-stable; \
|
||||||
elif [ "$(dpkg --print-architecture)" = "arm64" ]; then \
|
elif [ "$(dpkg --print-architecture)" = "arm64" ]; then \
|
||||||
apt-get install -y --no-install-recommends \
|
apt-get install -y --no-install-recommends \
|
||||||
chromium; \
|
chromium; \
|
||||||
fi \
|
fi \
|
||||||
# Create config directory for chromium/google-chrome-stable
|
# Create config directory for chromium/google-chrome-stable
|
||||||
&& mkdir /var/www/.config \
|
&& mkdir /var/www/.config \
|
||||||
@@ -70,6 +68,9 @@ COPY php/php.ini /usr/local/etc/php/conf.d/invoiceninja.ini
|
|||||||
|
|
||||||
COPY php/php-fpm.conf /usr/local/etc/php-fpm.d/invoiceninja.conf
|
COPY php/php-fpm.conf /usr/local/etc/php-fpm.d/invoiceninja.conf
|
||||||
|
|
||||||
|
# Workaround: Disable SSL for mariadb-client for compatibility with MySQL
|
||||||
|
RUN echo "skip-ssl = true" >> /etc/mysql/mariadb.conf.d/50-client.cnf
|
||||||
|
|
||||||
# Setup supervisor
|
# Setup supervisor
|
||||||
COPY supervisor/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
COPY supervisor/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
||||||
|
|
||||||
@@ -81,8 +82,8 @@ COPY --from=prepare-app /tmp/public /tmp/public
|
|||||||
COPY --chmod=0755 scripts/init.sh /usr/local/bin/init.sh
|
COPY --chmod=0755 scripts/init.sh /usr/local/bin/init.sh
|
||||||
|
|
||||||
# Health check
|
# Health check
|
||||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=30s --retries=3 \
|
HEALTHCHECK --start-period=100s \
|
||||||
CMD pgrep -f "php-fpm: master process"
|
CMD REMOTE_ADDR=127.0.0.1 REQUEST_URI=/health REQUEST_METHOD=GET SCRIPT_FILENAME=/var/www/html/public/index.php cgi-fcgi -bind -connect 127.0.0.1:9000 | grep '{"status":"ok","message":"API is healthy"}'
|
||||||
|
|
||||||
ENTRYPOINT ["/usr/local/bin/init.sh"]
|
ENTRYPOINT ["/usr/local/bin/init.sh"]
|
||||||
CMD ["supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
|
CMD ["supervisord", "-c", "/etc/supervisor/supervisord.conf"]
|
||||||
|
|||||||
6
debian/docker-compose.yml
vendored
6
debian/docker-compose.yml
vendored
@@ -17,7 +17,6 @@ services:
|
|||||||
# - ./php/php.ini:/usr/local/etc/php/conf.d/invoiceninja.ini:ro
|
# - ./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
|
# - ./php/php-fpm.conf:/usr/local/etc/php-fpm.d/invoiceninja.conf:ro
|
||||||
# - ./supervisor/supervisord.conf:/etc/supervisor/conf.d/supervisord.conf:ro
|
# - ./supervisor/supervisord.conf:/etc/supervisor/conf.d/supervisord.conf:ro
|
||||||
- app_cache:/var/www/html/bootstrap/cache
|
|
||||||
- app_public:/var/www/html/public
|
- app_public:/var/www/html/public
|
||||||
- app_storage:/var/www/html/storage
|
- app_storage:/var/www/html/storage
|
||||||
networks:
|
networks:
|
||||||
@@ -41,7 +40,8 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
- app-network
|
- app-network
|
||||||
depends_on:
|
depends_on:
|
||||||
- app
|
app:
|
||||||
|
condition: service_healthy
|
||||||
logging: *default-logging
|
logging: *default-logging
|
||||||
|
|
||||||
mysql:
|
mysql:
|
||||||
@@ -84,8 +84,6 @@ networks:
|
|||||||
driver: bridge
|
driver: bridge
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
app_cache:
|
|
||||||
driver: local
|
|
||||||
app_public:
|
app_public:
|
||||||
driver: local
|
driver: local
|
||||||
app_storage:
|
app_storage:
|
||||||
|
|||||||
31
debian/scripts/init.sh
vendored
31
debian/scripts/init.sh
vendored
@@ -1,6 +1,20 @@
|
|||||||
#!/bin/sh -eu
|
#!/bin/sh -eu
|
||||||
|
|
||||||
if [ "$*" = 'supervisord -c /etc/supervisor/conf.d/supervisord.conf' ]; then
|
# 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
|
||||||
|
|
||||||
|
if [ "$*" = 'supervisord -c /etc/supervisor/supervisord.conf' ]; then
|
||||||
|
|
||||||
|
# Check for required folders and create if needed
|
||||||
|
[ -d /var/www/html/storage/app/public ] || mkdir -p /var/www/html/storage/app/public
|
||||||
|
[ -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
|
||||||
|
|
||||||
# Workaround for application updates
|
# Workaround for application updates
|
||||||
if [ "$(ls -A /tmp/public)" ]; then
|
if [ "$(ls -A /tmp/public)" ]; then
|
||||||
echo "Updating public folder..."
|
echo "Updating public folder..."
|
||||||
@@ -27,24 +41,25 @@ if [ "$*" = 'supervisord -c /etc/supervisor/conf.d/supervisord.conf' ]; then
|
|||||||
|
|
||||||
# Clear and cache config in production
|
# Clear and cache config in production
|
||||||
if [ "$APP_ENV" = "production" ]; then
|
if [ "$APP_ENV" = "production" ]; then
|
||||||
|
runuser -u www-data -- php artisan migrate --force
|
||||||
|
runuser -u www-data -- php artisan cache:clear # Clear after the migration
|
||||||
|
runuser -u www-data -- php artisan ninja:design-update
|
||||||
runuser -u www-data -- php artisan optimize
|
runuser -u www-data -- php artisan optimize
|
||||||
runuser -u www-data -- php artisan package:discover
|
|
||||||
runuser -u www-data -- php artisan migrate --force
|
|
||||||
|
|
||||||
# If first IN run, it needs to be initialized
|
# If first IN run, it needs to be initialized
|
||||||
if [ "$(php -d opcache.preload='' artisan tinker --execute='echo Schema::hasTable("accounts") && !App\Models\Account::all()->first();')" = "1" ]; then
|
if [ "$(runuser -u www-data -- php artisan tinker --execute='echo Schema::hasTable("accounts") && !App\Models\Account::all()->first();')" = "1" ]; then
|
||||||
echo "Running initialization..."
|
echo "Running initialization..."
|
||||||
|
|
||||||
php artisan db:seed --force
|
runuser -u www-data -- php artisan db:seed --force
|
||||||
|
|
||||||
if [ -n "${IN_USER_EMAIL}" ] && [ -n "${IN_PASSWORD}" ]; then
|
if [ -n "${IN_USER_EMAIL}" ] && [ -n "${IN_PASSWORD}" ]; then
|
||||||
php artisan ninja:create-account --email "${IN_USER_EMAIL}" --password "${IN_PASSWORD}"
|
runuser -u www-data -- php artisan ninja:create-account --email "${IN_USER_EMAIL}" --password "${IN_PASSWORD}"
|
||||||
else
|
else
|
||||||
echo "Initialization failed - Set IN_USER_EMAIL and IN_PASSWORD in .env"
|
echo "Initialization failed - Set IN_USER_EMAIL and IN_PASSWORD in .env"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
|
fi
|
||||||
echo "Production setup completed"
|
echo "Production setup completed"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
3
debian/supervisor/supervisord.conf
vendored
3
debian/supervisor/supervisord.conf
vendored
@@ -5,9 +5,6 @@ logfile=/dev/null
|
|||||||
logfile_maxbytes=0
|
logfile_maxbytes=0
|
||||||
pidfile=/var/run/supervisord.pid
|
pidfile=/var/run/supervisord.pid
|
||||||
|
|
||||||
[rpcinterface:supervisor]
|
|
||||||
supervisor.rpcinterface_factory=supervisor.rpcinterface:make_main_rpcinterface
|
|
||||||
|
|
||||||
[program:php-fpm]
|
[program:php-fpm]
|
||||||
command=/usr/local/sbin/php-fpm -F
|
command=/usr/local/sbin/php-fpm -F
|
||||||
autostart=true
|
autostart=true
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
|
|
||||||
Reference in New Issue
Block a user