mirror of
https://github.com/invoiceninja/dockerfiles.git
synced 2026-01-06 14:37:26 +01:00
Compare commits
40 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 | ||
|
|
a71af868d2 | ||
|
|
237abe4aa8 | ||
|
|
f680c8a59a | ||
|
|
8f51f3bc51 | ||
|
|
e4c26dde5d | ||
|
|
9c96e9d261 | ||
|
|
e1cde6b6be | ||
|
|
068acdd097 | ||
|
|
95aec27c65 | ||
|
|
6c6950d298 |
19
.github/workflows/auto-close-issues.yml
vendored
19
.github/workflows/auto-close-issues.yml
vendored
@@ -1,19 +0,0 @@
|
|||||||
name: Close stale issues after 5 days
|
|
||||||
on:
|
|
||||||
schedule:
|
|
||||||
- cron: "0 0 * * *"
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
close-issues:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
|
||||||
issues: write
|
|
||||||
steps:
|
|
||||||
- uses: actions/stale@v10
|
|
||||||
with:
|
|
||||||
days-before-issue-stale: 4
|
|
||||||
days-before-issue-close: 1
|
|
||||||
stale-issue-label: "stale"
|
|
||||||
close-issue-message: "This issue has been automatically closed due to inactivity for 5 days."
|
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
exempt-issue-labels: "keep-open,triage,bug"
|
|
||||||
41
.github/workflows/build-image-debian.yaml
vendored
41
.github/workflows/build-image-debian.yaml
vendored
@@ -1,49 +1,38 @@
|
|||||||
name: Build Debian Container Image
|
name: Build Debian Octane Container Image
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
paths:
|
paths:
|
||||||
- ".github/**"
|
|
||||||
- "debian/**"
|
- "debian/**"
|
||||||
push:
|
push:
|
||||||
paths:
|
paths:
|
||||||
- ".github/**"
|
|
||||||
- "debian/**"
|
- "debian/**"
|
||||||
|
branches:
|
||||||
env:
|
- master
|
||||||
REGISTRY_IMAGE: invoiceninja/invoiceninja-debian
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
docker:
|
||||||
runs-on: ${{ startsWith(matrix.platform, 'linux/arm') && 'ubuntu-24.04-arm' || 'ubuntu-latest' }}
|
runs-on: ubuntu-22.04
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
platform:
|
|
||||||
- linux/amd64
|
|
||||||
- linux/arm64
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v5
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Docker meta
|
- name: Set up QEMU
|
||||||
id: meta
|
uses: docker/setup-qemu-action@v3
|
||||||
uses: docker/metadata-action@v5
|
|
||||||
with:
|
with:
|
||||||
images: ${{ env.REGISTRY_IMAGE }}
|
platforms: all
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
id: buildx
|
id: buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
id: build
|
id: docker_build
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
context: debian
|
context: debian
|
||||||
platforms: ${{ matrix.platform }}
|
file: debian/Dockerfile
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
load: true
|
||||||
tags: ${{ env.REGISTRY_IMAGE }}
|
tags: invoiceninja/invoiceninja-octane:test
|
||||||
outputs: type=image,push-by-digest=true,name-canonical=true
|
|
||||||
cache-from: type=gha
|
cache-from: type=gha
|
||||||
cache-to: type=gha,mode=max
|
cache-to: type=gha,mode=max
|
||||||
|
|||||||
166
.github/workflows/publish-image-debian.yaml
vendored
166
.github/workflows/publish-image-debian.yaml
vendored
@@ -1,166 +0,0 @@
|
|||||||
name: Publish Debian Container Images
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags-ignore:
|
|
||||||
- "invoiceninja-*"
|
|
||||||
|
|
||||||
env:
|
|
||||||
REGISTRY_IMAGE: invoiceninja/invoiceninja-debian
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
version:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
outputs:
|
|
||||||
version: ${{ steps.version.outputs.version }}
|
|
||||||
major: ${{ steps.version.outputs.major }}
|
|
||||||
minor: ${{ steps.version.outputs.minor }}
|
|
||||||
url: ${{ steps.version.outputs.url }}
|
|
||||||
steps:
|
|
||||||
- id: version
|
|
||||||
run: |
|
|
||||||
|
|
||||||
VERSION=edge
|
|
||||||
if [[ $GITHUB_REF == refs/tags/* ]]; then
|
|
||||||
VERSION=${GITHUB_REF#refs/tags/}
|
|
||||||
# Remove -o or -d suffix if present
|
|
||||||
VERSION=${VERSION%-*}
|
|
||||||
fi
|
|
||||||
MAJOR="$(echo "${VERSION}" | cut -d. -f1)"
|
|
||||||
MINOR="$(echo "${VERSION}" | cut -d. -f2)"
|
|
||||||
URL=https://github.com/invoiceninja/invoiceninja/releases/download/v${VERSION}/invoiceninja.tar.gz
|
|
||||||
|
|
||||||
# Debug output
|
|
||||||
echo "Current version: ${VERSION}"
|
|
||||||
echo "Version pattern check: $([[ $VERSION =~ ^5\.[0-9]{1,3}\.[0-9]{1,3}$ ]] && echo "matches" || echo "doesn't match")"
|
|
||||||
|
|
||||||
echo "version=${VERSION}" >> $GITHUB_OUTPUT
|
|
||||||
echo "major=${MAJOR}" >> $GITHUB_OUTPUT
|
|
||||||
echo "minor=${MINOR}" >> $GITHUB_OUTPUT
|
|
||||||
echo "url=${URL}" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
build:
|
|
||||||
runs-on: ${{ startsWith(matrix.platform, 'linux/arm') && 'ubuntu-24.04-arm' || 'ubuntu-latest' }}
|
|
||||||
needs:
|
|
||||||
- version
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
platform:
|
|
||||||
- linux/amd64
|
|
||||||
- linux/arm64
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v5
|
|
||||||
|
|
||||||
- name: Prepare
|
|
||||||
id: prep
|
|
||||||
run: |
|
|
||||||
platform=${{ matrix.platform }}
|
|
||||||
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Docker meta
|
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@v5
|
|
||||||
with:
|
|
||||||
images: ${{ env.REGISTRY_IMAGE }}
|
|
||||||
|
|
||||||
- name: Login to DockerHub
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
id: buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
|
|
||||||
- name: Build and push by digest
|
|
||||||
id: build
|
|
||||||
uses: docker/build-push-action@v6
|
|
||||||
with:
|
|
||||||
context: debian
|
|
||||||
build-args: URL=${{ needs.version.outputs.url }}
|
|
||||||
platforms: ${{ matrix.platform }}
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
||||||
tags: ${{ env.REGISTRY_IMAGE }}
|
|
||||||
outputs: type=image,push-by-digest=true,name-canonical=true,push=${{ github.event_name != 'pull_request' }}
|
|
||||||
cache-from: type=gha
|
|
||||||
cache-to: type=gha,mode=max
|
|
||||||
|
|
||||||
- name: Export digest
|
|
||||||
run: |
|
|
||||||
mkdir -p ${{ runner.temp }}/digests
|
|
||||||
digest="${{ steps.build.outputs.digest }}"
|
|
||||||
touch "${{ runner.temp }}/digests/${digest#sha256:}"
|
|
||||||
|
|
||||||
- name: Upload digest
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: digests-${{ env.PLATFORM_PAIR }}
|
|
||||||
path: ${{ runner.temp }}/digests/*
|
|
||||||
if-no-files-found: error
|
|
||||||
retention-days: 1
|
|
||||||
|
|
||||||
merge:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs:
|
|
||||||
- version
|
|
||||||
- build
|
|
||||||
steps:
|
|
||||||
- name: Download digests
|
|
||||||
uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
path: ${{ runner.temp }}/digests
|
|
||||||
pattern: digests-*
|
|
||||||
merge-multiple: true
|
|
||||||
|
|
||||||
- name: Login to Docker Hub
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
|
|
||||||
- name: Docker meta
|
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@v5
|
|
||||||
with:
|
|
||||||
images: ${{ env.REGISTRY_IMAGE }}
|
|
||||||
tags: |
|
|
||||||
${{ needs.version.outputs.version }}
|
|
||||||
${{ needs.version.outputs.major }}
|
|
||||||
${{ needs.version.outputs.major }}.${{ needs.version.outputs.minor }}
|
|
||||||
latest
|
|
||||||
|
|
||||||
- name: Create manifest list and push
|
|
||||||
working-directory: ${{ runner.temp }}/digests
|
|
||||||
if: ${{ github.event_name != 'pull_request' }}
|
|
||||||
run: |
|
|
||||||
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
|
|
||||||
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
|
|
||||||
|
|
||||||
- name: Inspect image
|
|
||||||
if: ${{ github.event_name != 'pull_request' }}
|
|
||||||
run: |
|
|
||||||
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}
|
|
||||||
|
|
||||||
Description:
|
|
||||||
if: ${{ github.event_name != 'pull_request' }}
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs:
|
|
||||||
- merge
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v5
|
|
||||||
with:
|
|
||||||
sparse-checkout: "README.md"
|
|
||||||
|
|
||||||
- name: Docker Hub Description
|
|
||||||
uses: peter-evans/dockerhub-description@v4
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
|
||||||
repository: ${{ env.REGISTRY_IMAGE }}
|
|
||||||
75
.github/workflows/publish-image.yaml
vendored
Normal file
75
.github/workflows/publish-image.yaml
vendored
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
name: Publish Debian Container Images
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags-ignore:
|
||||||
|
- "invoiceninja-*"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
docker:
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- image: invoiceninja/invoiceninja-octane
|
||||||
|
context: debian
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Prepare
|
||||||
|
id: prep
|
||||||
|
run: |
|
||||||
|
DOCKER_IMAGE=${{ matrix.image }}
|
||||||
|
VERSION=edge
|
||||||
|
if [[ $GITHUB_REF == refs/tags/* ]]; then
|
||||||
|
VERSION=${GITHUB_REF#refs/tags/}
|
||||||
|
fi
|
||||||
|
TAGS="${DOCKER_IMAGE}:${VERSION}"
|
||||||
|
MAJOR="$(echo "${VERSION}" | cut -d. -f1)"
|
||||||
|
MINOR="$(echo "${VERSION}" | cut -d. -f2)"
|
||||||
|
TAGS="$TAGS,${DOCKER_IMAGE}:${MAJOR},${DOCKER_IMAGE}:${MAJOR}.${MINOR}"
|
||||||
|
|
||||||
|
# Debug output
|
||||||
|
echo "Current version: ${VERSION}"
|
||||||
|
echo "Version pattern check: $([[ $VERSION =~ ^5\.[0-9]{1,3}\.[0-9]{1,3}$ ]] && echo "matches" || echo "doesn't match")"
|
||||||
|
|
||||||
|
TAGS="$TAGS,${DOCKER_IMAGE}:latest"
|
||||||
|
|
||||||
|
echo "tags=${TAGS}" >> $GITHUB_OUTPUT # Updated output syntax
|
||||||
|
echo "version=${VERSION}" >> $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
|
||||||
|
id: buildx
|
||||||
|
uses: docker/setup-buildx-action@v3 # Updated from v1
|
||||||
|
|
||||||
|
- name: Login to DockerHub
|
||||||
|
if: github.event_name != 'pull_request'
|
||||||
|
uses: docker/login-action@v3 # Updated from v1
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Build and push
|
||||||
|
id: docker_build
|
||||||
|
uses: docker/build-push-action@v5 # Updated from v2
|
||||||
|
with:
|
||||||
|
context: ${{ matrix.context }}
|
||||||
|
build-args: INVOICENINJA_VERSION=${{ steps.prep.outputs.version }}
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
|
tags: ${{ steps.prep.outputs.tags }}
|
||||||
|
cache-from: type=gha # Updated cache type
|
||||||
|
cache-to: type=gha,mode=max
|
||||||
|
|
||||||
|
- name: Image digest
|
||||||
|
run: echo ${{ steps.docker_build.outputs.digest }}
|
||||||
17
README.md
17
README.md
@@ -1,11 +1,11 @@
|
|||||||
[](https://hub.docker.com/r/invoiceninja/invoiceninja-debian)
|
[](https://hub.docker.com/r/invoiceninja/invoiceninja-debian)
|
||||||
[](https://hub.docker.com/r/invoiceninja/invoiceninja-debian)
|
[](https://hub.docker.com/r/invoiceninja/invoiceninja-debian)
|
||||||
[](https://github.com/invoiceninja/dockerfiles/actions/workflows/publish-image-debian.yaml)
|
[](https://github.com/invoiceninja/dockerfiles/actions/workflows/publish-image.yaml)
|
||||||
[](https://github.com/invoiceninja/dockerfiles/actions/workflows/build-image-debian.yaml)
|
[](https://github.com/invoiceninja/dockerfiles/actions/workflows/build-image-v5.yaml)
|
||||||
|
|
||||||
# Debian Docker for [Invoice Ninja](https://www.invoiceninja.com/)
|
# Debian Docker for [Invoice Ninja](https://www.invoiceninja.com/)
|
||||||
|
|
||||||
👑 **Features**
|
:crown: **Features**
|
||||||
|
|
||||||
NGINX webserver support [NGINX](https://nginx.org/)
|
NGINX webserver support [NGINX](https://nginx.org/)
|
||||||
Built-in Chrome for PDF generation and other features
|
Built-in Chrome for PDF generation and other features
|
||||||
@@ -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,8 +74,9 @@ 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 pull
|
docker-compose down
|
||||||
docker compose up -d
|
docker-compose pull
|
||||||
|
docker-compose up
|
||||||
```
|
```
|
||||||
|
|
||||||
It is recommended to perform a backup before updating.
|
It is recommended to perform a backup before updating.
|
||||||
@@ -91,4 +92,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
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
77
debian/Dockerfile
vendored
77
debian/Dockerfile
vendored
@@ -1,33 +1,38 @@
|
|||||||
ARG PHP=8.4
|
FROM dunglas/frankenphp:1-php8.3-bookworm AS prepare-app
|
||||||
|
|
||||||
FROM php:${PHP}-fpm AS prepare-app
|
RUN curl -s "https://api.github.com/repos/invoiceninja/invoiceninja/releases/latest" | \
|
||||||
|
grep -o '"browser_download_url": "[^"]*invoiceninja.tar.gz"' | \
|
||||||
ARG URL=https://github.com/invoiceninja/invoiceninja/releases/latest/download/invoiceninja.tar.gz
|
cut -d '"' -f 4 | \
|
||||||
|
xargs curl -sL | \
|
||||||
ADD ${URL} /tmp/invoiceninja.tar.gz
|
tar -xz --strip-components=1 \
|
||||||
|
&& ln -s ./resources/views/react/index.blade.php ./public/index.html \
|
||||||
RUN tar -xzf /tmp/invoiceninja.tar.gz -C /var/www/html \
|
# Symlink
|
||||||
&& ln -s /var/www/html/resources/views/react/index.blade.php /var/www/html/public/index.html \
|
|
||||||
&& php artisan storage:link \
|
&& php artisan storage:link \
|
||||||
# Workaround for application updates
|
# Octane
|
||||||
&& mv /var/www/html/public /tmp/public
|
&& php artisan octane:install --server=frankenphp
|
||||||
|
|
||||||
# ==================
|
# ==================
|
||||||
# InvoiceNinja image
|
# InvoiceNinja image
|
||||||
# ==================
|
# ==================
|
||||||
FROM php:${PHP}-fpm
|
FROM dunglas/frankenphp:1-php8.3-bookworm
|
||||||
|
|
||||||
|
ARG user=ninja
|
||||||
|
|
||||||
# PHP modules
|
# PHP modules
|
||||||
ARG php_require="bcmath gd mbstring pdo_mysql zip"
|
ARG php_require="bcmath gd pdo_mysql zip"
|
||||||
ARG php_suggest="exif imagick intl pcntl saxon soap"
|
ARG php_suggest="exif imagick intl pcntl soap saxon-12.5.0"
|
||||||
ARG php_extra="opcache"
|
ARG php_extra="opcache"
|
||||||
|
|
||||||
|
# Create a system user UID/GID=999
|
||||||
|
RUN useradd -r ${user}
|
||||||
|
|
||||||
|
# Allow to bind to privileged ports
|
||||||
|
RUN setcap CAP_NET_BIND_SERVICE=+eip /usr/local/bin/frankenphp
|
||||||
|
|
||||||
# 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 \
|
|
||||||
# Unicode support for PDF
|
# Unicode support for PDF
|
||||||
fonts-noto-cjk-extra \
|
fonts-noto-cjk-extra \
|
||||||
fonts-wqy-microhei \
|
fonts-wqy-microhei \
|
||||||
@@ -40,14 +45,15 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||||||
gpg --dearmor -o /etc/apt/keyrings/google.gpg \
|
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 \
|
&& 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 update \
|
||||||
&& apt-get install -y --no-install-recommends google-chrome-stable; \
|
&& apt-get install -y --no-install-recommends google-chrome-stable \
|
||||||
|
&& mkdir /config/google-chrome \
|
||||||
|
&& chown ${user}: /config/google-chrome; \
|
||||||
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 \
|
||||||
|
&& mkdir /config/chromium \
|
||||||
|
&& chown ${user}: /config/chromium; \
|
||||||
fi \
|
fi \
|
||||||
# Create config directory for chromium/google-chrome-stable
|
|
||||||
&& mkdir /var/www/.config \
|
|
||||||
&& chown www-data:www-data /var/www/.config \
|
|
||||||
# Cleanup
|
# Cleanup
|
||||||
&& apt-get purge -y gpg \
|
&& apt-get purge -y gpg \
|
||||||
&& apt-get autoremove -y \
|
&& apt-get autoremove -y \
|
||||||
@@ -55,36 +61,33 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Install PHP extensions
|
# Install PHP extensions
|
||||||
COPY --from=ghcr.io/mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
|
|
||||||
|
|
||||||
RUN install-php-extensions \
|
RUN install-php-extensions \
|
||||||
${php_require} \
|
${php_require} \
|
||||||
${php_suggest} \
|
${php_suggest} \
|
||||||
${php_extra}
|
${php_extra}
|
||||||
|
|
||||||
# Configure PHP
|
# Configure PHP
|
||||||
RUN ln -s "$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
|
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
|
# Create directory for artisan tinker (init.sh)
|
||||||
|
RUN mkdir /config/psysh \
|
||||||
|
&& chown ${user}: /config/psysh
|
||||||
|
|
||||||
# Workaround: Disable SSL for mariadb-client for compatibility with MySQL
|
# Change owner for caddy directories
|
||||||
RUN echo "skip-ssl = true" >> /etc/mysql/mariadb.conf.d/50-client.cnf
|
RUN chown -R ${user}: \
|
||||||
|
/data/caddy \
|
||||||
|
/config/caddy
|
||||||
|
|
||||||
# Setup supervisor
|
# InvoiceNinja
|
||||||
COPY supervisor/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
COPY --from=prepare-app --chown=${user}:${user} /app /app
|
||||||
|
|
||||||
# Setup InvoiceNinja
|
|
||||||
COPY --from=prepare-app --chown=www-data:www-data /var/www/html /var/www/html
|
|
||||||
COPY --from=prepare-app --chown=www-data:www-data /tmp/public /tmp/public
|
|
||||||
|
|
||||||
# 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
|
||||||
|
|
||||||
# Health check
|
USER ${user}
|
||||||
HEALTHCHECK --start-period=100s \
|
|
||||||
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/supervisord.conf"]
|
|
||||||
|
CMD ["frankenphp", "php-cli", "artisan", "octane:frankenphp"]
|
||||||
|
|||||||
142
debian/docker-compose.yml
vendored
142
debian/docker-compose.yml
vendored
@@ -1,39 +1,94 @@
|
|||||||
|
# name: invoiceninja
|
||||||
|
|
||||||
|
x-logging: &default-logging
|
||||||
|
options:
|
||||||
|
max-size: "10m"
|
||||||
|
max-file: "3"
|
||||||
|
driver: json-file
|
||||||
|
|
||||||
|
x-app-volumes: &volumes
|
||||||
|
volumes:
|
||||||
|
- ./.env:/app/.env
|
||||||
|
- app_cache:/var/www/html/bootstrap/cache
|
||||||
|
- app_storage:/app/storage
|
||||||
|
- caddy_data:/data
|
||||||
|
|
||||||
services:
|
services:
|
||||||
app:
|
app:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
image: invoiceninja/invoiceninja-debian:${TAG:-latest}
|
image: invoiceninja/invoiceninja-debian:${TAG:-latest}
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
# php artisan help octane:frankenphp
|
||||||
|
command: --port=80 --workers=2 --log-level=info
|
||||||
|
# command: --host=example.com --port=443 --workers=2 --https --http-redirect --log-level=info
|
||||||
|
ports:
|
||||||
|
- "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
|
||||||
volumes:
|
environment:
|
||||||
# - ./php/php.ini:/usr/local/etc/php/conf.d/invoiceninja.ini:ro
|
LARAVEL_ROLE: app
|
||||||
# - ./php/php-fpm.conf:/usr/local/etc/php-fpm.d/invoiceninja.conf:ro
|
<<: *volumes
|
||||||
# - ./supervisor/supervisord.conf:/etc/supervisor/conf.d/supervisord.conf:ro
|
# HEALTHCHECK from frankenphp image
|
||||||
- app_public:/var/www/html/public
|
healthcheck:
|
||||||
- app_storage:/var/www/html/storage
|
start_period: 180s
|
||||||
depends_on:
|
depends_on:
|
||||||
mysql:
|
mysql:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
redis:
|
redis:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
|
# mariadb:
|
||||||
nginx:
|
# condition: service_healthy
|
||||||
image: nginx:alpine
|
# valkey:
|
||||||
|
# condition: service_healthy
|
||||||
|
logging: *default-logging
|
||||||
|
|
||||||
|
app-worker:
|
||||||
|
image: invoiceninja/invoiceninja-debian:${TAG:-latest}
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
ports:
|
# php artisan help queue:work
|
||||||
- "80:80"
|
command: --verbose --sleep=3 --tries=3 --max-time=3600
|
||||||
volumes:
|
deploy:
|
||||||
- ./nginx:/etc/nginx/conf.d:ro
|
mode: replicated
|
||||||
- app_public:/var/www/html/public:ro
|
replicas: 2
|
||||||
- app_storage:/var/www/html/storage:ro
|
env_file:
|
||||||
|
- ./.env
|
||||||
|
environment:
|
||||||
|
LARAVEL_ROLE: worker
|
||||||
|
<<: *volumes
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "pgrep", "-f", "queue:work"]
|
||||||
|
start_period: 10s
|
||||||
depends_on:
|
depends_on:
|
||||||
app:
|
app:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
|
logging: *default-logging
|
||||||
|
|
||||||
|
app-scheduler:
|
||||||
|
image: invoiceninja/invoiceninja-debian:${TAG:-latest}
|
||||||
|
restart: unless-stopped
|
||||||
|
# php artisan help schedule:work
|
||||||
|
command: --verbose
|
||||||
|
env_file:
|
||||||
|
- ./.env
|
||||||
|
environment:
|
||||||
|
LARAVEL_ROLE: scheduler
|
||||||
|
<<: *volumes
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "pgrep", "-f", "schedule:work"]
|
||||||
|
start_period: 10s
|
||||||
|
depends_on:
|
||||||
|
app:
|
||||||
|
condition: service_healthy
|
||||||
|
logging: *default-logging
|
||||||
|
|
||||||
mysql:
|
mysql:
|
||||||
image: mysql:8
|
image: mysql:8
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
env_file:
|
||||||
|
- ./.env
|
||||||
environment:
|
environment:
|
||||||
MYSQL_DATABASE: ${DB_DATABASE}
|
MYSQL_DATABASE: ${DB_DATABASE}
|
||||||
MYSQL_USER: ${DB_USERNAME}
|
MYSQL_USER: ${DB_USERNAME}
|
||||||
@@ -42,16 +97,11 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- mysql_data:/var/lib/mysql
|
- mysql_data:/var/lib/mysql
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test:
|
test: [ "CMD", "mysqladmin", "ping", "-h", "localhost", "-u${MYSQL_USER}", "-p${MYSQL_PASSWORD}" ]
|
||||||
[
|
interval: 10s
|
||||||
"CMD",
|
timeout: 5s
|
||||||
"mysqladmin",
|
retries: 5
|
||||||
"ping",
|
logging: *default-logging
|
||||||
"-h",
|
|
||||||
"localhost",
|
|
||||||
"-u${MYSQL_USER}",
|
|
||||||
"-p${MYSQL_PASSWORD}",
|
|
||||||
]
|
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
image: redis:alpine
|
image: redis:alpine
|
||||||
@@ -59,14 +109,44 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- redis_data:/data
|
- redis_data:/data
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "redis-cli", "ping"]
|
test: [ "CMD", "redis-cli", "ping" ]
|
||||||
|
interval: 10s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
|
logging: *default-logging
|
||||||
|
|
||||||
|
# mariadb:
|
||||||
|
# image: mariadb:11.4
|
||||||
|
# restart: unless-stopped
|
||||||
|
# env_file:
|
||||||
|
# - ./.env
|
||||||
|
# environment:
|
||||||
|
# MARIADB_DATABASE: ${DB_DATABASE}
|
||||||
|
# MARIADB_USER: ${DB_USERNAME}
|
||||||
|
# MARIADB_PASSWORD: ${DB_PASSWORD}
|
||||||
|
# MARIADB_ROOT_PASSWORD: ${DB_ROOT_PASSWORD}
|
||||||
|
# volumes:
|
||||||
|
# - mariadb:/var/lib/mysql
|
||||||
|
# healthcheck:
|
||||||
|
# test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
|
||||||
|
# start_period: 60s
|
||||||
|
# logging: *default-logging
|
||||||
|
|
||||||
|
# valkey:
|
||||||
|
# image: valkey/valkey:8
|
||||||
|
# restart: unless-stopped
|
||||||
|
# volumes:
|
||||||
|
# - valkey:/data
|
||||||
|
# healthcheck:
|
||||||
|
# test: [ "CMD", "valkey-cli", "ping" ]
|
||||||
|
# start_period: 10s
|
||||||
|
# logging: *default-logging
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
app_public:
|
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:
|
||||||
|
# valkey:
|
||||||
|
|||||||
14
debian/nginx/invoiceninja.conf
vendored
14
debian/nginx/invoiceninja.conf
vendored
@@ -1,14 +0,0 @@
|
|||||||
# https://nginx.org/en/docs/http/ngx_http_core_module.html
|
|
||||||
client_max_body_size 10M;
|
|
||||||
client_body_buffer_size 10M;
|
|
||||||
server_tokens off;
|
|
||||||
|
|
||||||
# https://nginx.org/en/docs/http/ngx_http_fastcgi_module.html
|
|
||||||
fastcgi_buffers 32 16K;
|
|
||||||
|
|
||||||
# https://nginx.org/en/docs/http/ngx_http_gzip_module.html
|
|
||||||
gzip on;
|
|
||||||
gzip_comp_level 2;
|
|
||||||
gzip_min_length 1M;
|
|
||||||
gzip_proxied any;
|
|
||||||
gzip_types *;
|
|
||||||
32
debian/nginx/laravel.conf
vendored
32
debian/nginx/laravel.conf
vendored
@@ -1,32 +0,0 @@
|
|||||||
# https://laravel.com/docs/master/deployment#nginx
|
|
||||||
server {
|
|
||||||
listen 80 default_server;
|
|
||||||
server_name _;
|
|
||||||
root /var/www/html/public;
|
|
||||||
|
|
||||||
add_header X-Frame-Options "SAMEORIGIN";
|
|
||||||
add_header X-Content-Type-Options "nosniff";
|
|
||||||
|
|
||||||
index index.php;
|
|
||||||
|
|
||||||
charset utf-8;
|
|
||||||
|
|
||||||
location / {
|
|
||||||
try_files $uri $uri/ /index.php?$query_string;
|
|
||||||
}
|
|
||||||
|
|
||||||
location = /favicon.ico { access_log off; log_not_found off; }
|
|
||||||
location = /robots.txt { access_log off; log_not_found off; }
|
|
||||||
|
|
||||||
error_page 404 /index.php;
|
|
||||||
|
|
||||||
location ~ \.php$ {
|
|
||||||
fastcgi_pass app:9000;
|
|
||||||
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
|
|
||||||
include fastcgi_params;
|
|
||||||
}
|
|
||||||
|
|
||||||
location ~ /\.(?!well-known).* {
|
|
||||||
deny all;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
1
debian/php/php-fpm.conf
vendored
1
debian/php/php-fpm.conf
vendored
@@ -1 +0,0 @@
|
|||||||
pm.max_children = 10
|
|
||||||
5
debian/php/php.ini
vendored
5
debian/php/php.ini
vendored
@@ -2,7 +2,6 @@
|
|||||||
; 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
|
||||||
memory_limit=512M
|
|
||||||
|
|
||||||
[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
|
||||||
@@ -14,11 +13,11 @@ opcache.jit=tracing
|
|||||||
opcache.jit_buffer_size=64M
|
opcache.jit_buffer_size=64M
|
||||||
|
|
||||||
[extra]
|
[extra]
|
||||||
|
; https://frankenphp.dev/docs/performance/#php-performance
|
||||||
; http://symfony.com/doc/current/performance.html
|
; http://symfony.com/doc/current/performance.html
|
||||||
opcache.memory_consumption=256
|
opcache.memory_consumption=256
|
||||||
opcache.max_accelerated_files=20000
|
opcache.max_accelerated_files=20000
|
||||||
opcache.preload=/var/www/html/preload.php
|
opcache.preload=/app/preload.php
|
||||||
opcache.preload_user=www-data
|
|
||||||
opcache.validate_timestamps=0
|
opcache.validate_timestamps=0
|
||||||
realpath_cache_size = 4096K
|
realpath_cache_size = 4096K
|
||||||
realpath_cache_ttl = 600
|
realpath_cache_ttl = 600
|
||||||
|
|||||||
110
debian/scripts/init.sh
vendored
110
debian/scripts/init.sh
vendored
@@ -1,71 +1,85 @@
|
|||||||
#!/bin/sh -eu
|
#!/bin/sh -eu
|
||||||
|
|
||||||
# Set PDF generation browser path based on architecture
|
# Fallback to app
|
||||||
if [ "$(dpkg --print-architecture)" = "amd64" ]; then
|
role=${LARAVEL_ROLE:-app}
|
||||||
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 default CMD, flag(s) or empty CMD
|
||||||
|
if [ "$*" = 'frankenphp php-cli artisan octane:frankenphp' ] || [ "${1#-}" != "$1" ] || [ "$#" -eq "0" ]; then
|
||||||
|
|
||||||
# Check for required folders and create if needed
|
if [ "--help" = "$1" ]; then
|
||||||
[ -d /var/www/html/public ] || mkdir -p /var/www/html/public
|
echo [CMD]
|
||||||
[ -d /var/www/html/storage/app/public ] || mkdir -p /var/www/html/storage/app/public
|
echo "This image will execute specific CMDs based on the environment variable LARAVEL_ROLE"
|
||||||
[ -d /var/www/html/storage/framework/sessions ] || mkdir -p /var/www/html/storage/framework/sessions
|
echo
|
||||||
[ -d /var/www/html/storage/framework/views ] || mkdir -p /var/www/html/storage/framework/views
|
echo "LARAVEL_ROLE=app: frankenphp php-cli artisan octane:frankenphp (default)"
|
||||||
[ -d /var/www/html/storage/framework/cache ] || mkdir -p /var/www/html/storage/framework/cache
|
echo "LARAVEL_ROLE=worker: frankenphp php-cli artisan queue:work"
|
||||||
|
echo "LARAVEL_ROLE=scheduler: frankenphp php-cli artisan schedule:work"
|
||||||
# Workaround for application updates
|
echo
|
||||||
if [ "$(ls -A /tmp/public)" ]; then
|
echo [FLAGS]
|
||||||
echo "Updating public folder..."
|
echo To the CMD defined by LARAVEL_ROLE can be extended with flags for artisan commands
|
||||||
rm -rf /var/www/html/public/.htaccess \
|
echo
|
||||||
/var/www/html/public/.well-known \
|
echo Available flags can be displaced:
|
||||||
/var/www/html/public/*
|
echo docker run --rm invoiceninja/invoiceninja-debian frankenphp php-cli artisan help octane:frankenphp
|
||||||
cp -r /tmp/public/* \
|
echo docker run --rm invoiceninja/invoiceninja-debian frankenphp php-cli artisan queue:work
|
||||||
/tmp/public/.htaccess \
|
echo docker run --rm invoiceninja/invoiceninja-debian frankenphp php-cli artisan schedule:work
|
||||||
/tmp/public/.well-known \
|
echo
|
||||||
/var/www/html/public/ && \
|
echo Example:
|
||||||
rm -rf /tmp/public/*
|
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
|
fi
|
||||||
echo "Public Folder is up to date"
|
|
||||||
|
|
||||||
# Ensure owner, file and directory permissions are correct
|
# Run app
|
||||||
chown -R www-data:www-data \
|
if [ "${role}" = "app" ]; then
|
||||||
/var/www/html/public \
|
cmd="frankenphp php-cli artisan octane:frankenphp"
|
||||||
/var/www/html/storage
|
|
||||||
find /var/www/html/public \
|
|
||||||
/var/www/html/storage \
|
|
||||||
-type f -exec chmod 644 {} \;
|
|
||||||
find /var/www/html/public \
|
|
||||||
/var/www/html/storage \
|
|
||||||
-type d -exec chmod 755 {} \;
|
|
||||||
|
|
||||||
# Clear and cache config in production
|
if [ "$APP_ENV" = "production" ]; then
|
||||||
if [ "$APP_ENV" = "production" ]; then
|
frankenphp php-cli artisan optimize
|
||||||
runuser -u www-data -- php artisan migrate --force
|
fi
|
||||||
runuser -u www-data -- php artisan cache:clear # Clear after the migration
|
|
||||||
runuser -u www-data -- php artisan ninja:design-update
|
frankenphp php-cli artisan package:discover
|
||||||
runuser -u www-data -- php artisan optimize
|
|
||||||
|
# Run migrations (if any)
|
||||||
|
frankenphp php-cli artisan migrate --force
|
||||||
|
|
||||||
# If first IN run, it needs to be initialized
|
# If first IN run, it needs to be initialized
|
||||||
if [ "$(runuser -u www-data -- php artisan tinker --execute='echo Schema::hasTable("accounts") && !App\Models\Account::all()->first();')" = "1" ]; then
|
if [ "$(php -d opcache.preload='' artisan tinker --execute='echo Schema::hasTable("accounts") && !App\Models\Account::all()->first();')" = "1" ]; then
|
||||||
echo "Running initialization..."
|
echo "Running initialization..."
|
||||||
|
|
||||||
runuser -u www-data -- php artisan db:seed --force
|
frankenphp php-cli artisan db:seed --force
|
||||||
|
|
||||||
if [ -n "${IN_USER_EMAIL}" ] && [ -n "${IN_PASSWORD}" ]; then
|
if [ -n "${IN_USER_EMAIL}" ] && [ -n "${IN_PASSWORD}" ]; then
|
||||||
runuser -u www-data -- php artisan ninja:create-account --email "${IN_USER_EMAIL}" --password "${IN_PASSWORD}"
|
frankenphp php-cli 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"
|
||||||
|
# Run worker
|
||||||
|
elif [ "${role}" = "worker" ]; then
|
||||||
|
cmd="frankenphp php-cli artisan queue:work"
|
||||||
|
# Run scheduler
|
||||||
|
elif [ "${role}" = "scheduler" ]; then
|
||||||
|
cmd="frankenphp php-cli artisan schedule:work"
|
||||||
|
# Invalid role
|
||||||
|
else
|
||||||
|
echo "Invalid role: ${role}"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Starting supervisord..."
|
# Append flag(s) to role cmd
|
||||||
|
if [ "${1#-}" != "$1" ]; then
|
||||||
|
set -- ${cmd} "$@"
|
||||||
|
else
|
||||||
|
set -- ${cmd}
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec "$@"
|
exec "$@"
|
||||||
|
|||||||
39
debian/supervisor/supervisord.conf
vendored
39
debian/supervisor/supervisord.conf
vendored
@@ -1,39 +0,0 @@
|
|||||||
[supervisord]
|
|
||||||
nodaemon=true
|
|
||||||
user=root
|
|
||||||
logfile=/dev/null
|
|
||||||
logfile_maxbytes=0
|
|
||||||
pidfile=/var/run/supervisord.pid
|
|
||||||
|
|
||||||
[program:php-fpm]
|
|
||||||
command=/usr/local/sbin/php-fpm -F
|
|
||||||
autostart=true
|
|
||||||
autorestart=true
|
|
||||||
priority=5
|
|
||||||
stdout_logfile=/dev/fd/1
|
|
||||||
stdout_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 --verbose
|
|
||||||
autostart=true
|
|
||||||
autorestart=true
|
|
||||||
stopasgroup=true
|
|
||||||
killasgroup=true
|
|
||||||
user=www-data
|
|
||||||
numprocs=2
|
|
||||||
environment=HOME="/var/www"
|
|
||||||
stdout_logfile=/dev/fd/1
|
|
||||||
stdout_logfile_maxbytes=0
|
|
||||||
redirect_stderr=true
|
|
||||||
stopwaitsecs=3600
|
|
||||||
|
|
||||||
[program:scheduler]
|
|
||||||
command=php /var/www/html/artisan schedule:work --verbose
|
|
||||||
autostart=true
|
|
||||||
autorestart=true
|
|
||||||
user=www-data
|
|
||||||
stdout_logfile=/dev/fd/1
|
|
||||||
stdout_logfile_maxbytes=0
|
|
||||||
redirect_stderr=true
|
|
||||||
1
docker/app/public/.keep
Normal file
1
docker/app/public/.keep
Normal file
@@ -0,0 +1 @@
|
|||||||
|
|
||||||
1
docker/app/storage/.keep
Normal file
1
docker/app/storage/.keep
Normal file
@@ -0,0 +1 @@
|
|||||||
|
|
||||||
Reference in New Issue
Block a user