mirror of
https://github.com/invoiceninja/dockerfiles.git
synced 2026-01-04 21:47:25 +01:00
Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7238c8fab4 | ||
|
|
6e24faee43 | ||
|
|
1895f822f5 | ||
|
|
7a985b4d0d | ||
|
|
6c8a692c5e | ||
|
|
91a2a106e0 | ||
|
|
7bd0a56260 | ||
|
|
32e59e289b | ||
|
|
bafea492a9 | ||
|
|
9a56657aa4 | ||
|
|
f36968c788 | ||
|
|
ee060b45fd |
16
.github/workflows/build-image-debian.yaml
vendored
16
.github/workflows/build-image-debian.yaml
vendored
@@ -12,15 +12,14 @@ on:
|
||||
|
||||
jobs:
|
||||
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:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
with:
|
||||
platforms: all
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
id: buildx
|
||||
@@ -28,10 +27,9 @@ jobs:
|
||||
|
||||
- name: Build
|
||||
id: docker_build
|
||||
uses: docker/build-push-action@v5
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: debian
|
||||
file: debian/Dockerfile
|
||||
load: true
|
||||
tags: invoiceninja/invoiceninja-debian:test
|
||||
cache-from: type=gha
|
||||
|
||||
24
.github/workflows/publish-image.yaml
vendored
24
.github/workflows/publish-image.yaml
vendored
@@ -7,16 +7,18 @@ on:
|
||||
|
||||
jobs:
|
||||
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"]
|
||||
include:
|
||||
- image: invoiceninja/invoiceninja-debian
|
||||
context: ./debian
|
||||
context: debian
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4 # Updated from v2
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
@@ -43,33 +45,27 @@ jobs:
|
||||
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
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to DockerHub
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: docker/login-action@v3 # Updated from v1
|
||||
uses: docker/login-action@v3
|
||||
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
|
||||
uses: docker/build-push-action@v6
|
||||
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-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
- name: Image digest
|
||||
run: echo ${{ steps.docker_build.outputs.digest }}
|
||||
run: echo ${{ steps.docker_build.outputs.digest }}
|
||||
|
||||
@@ -74,9 +74,8 @@ 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 up -d
|
||||
```
|
||||
|
||||
It is recommended to perform a backup before updating.
|
||||
|
||||
4
debian/Dockerfile
vendored
4
debian/Dockerfile
vendored
@@ -1,4 +1,4 @@
|
||||
ARG PHP=8.3
|
||||
ARG PHP=8.4
|
||||
|
||||
FROM php:${PHP}-fpm AS prepare-app
|
||||
|
||||
@@ -82,7 +82,7 @@ COPY --from=prepare-app /tmp/public /tmp/public
|
||||
COPY --chmod=0755 scripts/init.sh /usr/local/bin/init.sh
|
||||
|
||||
# Health check
|
||||
HEALTHCHECK --start-period=10s \
|
||||
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"]
|
||||
|
||||
3
debian/docker-compose.yml
vendored
3
debian/docker-compose.yml
vendored
@@ -40,7 +40,8 @@ services:
|
||||
networks:
|
||||
- app-network
|
||||
depends_on:
|
||||
- app
|
||||
app:
|
||||
condition: service_healthy
|
||||
logging: *default-logging
|
||||
|
||||
mysql:
|
||||
|
||||
16
debian/scripts/init.sh
vendored
16
debian/scripts/init.sh
vendored
@@ -10,6 +10,7 @@ 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
|
||||
@@ -40,24 +41,25 @@ if [ "$*" = 'supervisord -c /etc/supervisor/supervisord.conf' ]; then
|
||||
|
||||
# Clear and cache config in production
|
||||
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 package:discover
|
||||
runuser -u www-data -- php artisan migrate --force
|
||||
|
||||
# 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..."
|
||||
|
||||
php artisan db:seed --force
|
||||
|
||||
runuser -u www-data -- 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}"
|
||||
runuser -u www-data -- 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
|
||||
|
||||
fi
|
||||
echo "Production setup completed"
|
||||
fi
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
Reference in New Issue
Block a user