39 - Add multi-arch build pipeline, fix prod Dockerfile, add .dockerignore
All checks were successful
CI / ci (push) Successful in 14m35s
CI / build (push) Successful in 45s

This commit is contained in:
myrmidex 2026-05-02 11:29:26 +02:00
parent c808696a3f
commit fe3711e57c
4 changed files with 69 additions and 7 deletions

13
.dockerignore Normal file
View file

@ -0,0 +1,13 @@
node_modules
vendor
.git
.forgejo
docker/dev
.env
.env.*
.env.testing
storage/logs/*
storage/framework/cache/*
storage/framework/sessions/*
storage/framework/views/*
tests

View file

@ -0,0 +1,47 @@
name: Build and Push Docker Image
on:
push:
branches: [main]
tags: ['v*']
jobs:
build:
runs-on: docker
container:
image: catthehacker/ubuntu:act-latest
steps:
- uses: https://data.forgejo.org/actions/checkout@v4
- name: Set up QEMU
uses: https://data.forgejo.org/docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: https://data.forgejo.org/docker/setup-buildx-action@v3
- name: Login to Forgejo Registry
uses: https://data.forgejo.org/docker/login-action@v3
with:
registry: forge.lvl0.xyz
username: ${{ github.actor }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Determine tags
id: meta
run: |
if [[ "${{ github.ref }}" == refs/tags/v* ]]; then
TAG="${{ github.ref_name }}"
echo "tags=forge.lvl0.xyz/myrmidex/incr:${TAG},forge.lvl0.xyz/myrmidex/incr:latest" >> $GITHUB_OUTPUT
else
echo "tags=forge.lvl0.xyz/myrmidex/incr:latest" >> $GITHUB_OUTPUT
fi
- name: Build and push
uses: https://data.forgejo.org/docker/build-push-action@v5
with:
context: .
file: docker/production/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}

View file

@ -7,7 +7,7 @@ WORKDIR /app
COPY package*.json ./
# Install Node dependencies
RUN npm ci --only=production
RUN npm ci
# Copy frontend source
COPY resources/ resources/
@ -21,7 +21,7 @@ COPY eslint.config.js ./
RUN npm run build
# PHP runtime stage
FROM php:8.2-fpm-alpine
FROM php:8.3-fpm-alpine
# Install system dependencies
RUN apk add --no-cache \
@ -61,9 +61,9 @@ RUN composer install --no-dev --optimize-autoloader --no-interaction
COPY --from=frontend-builder /app/public/build/ ./public/build/
# Copy nginx and supervisor configurations
COPY docker/nginx.conf /etc/nginx/http.d/default.conf
COPY docker/supervisord.conf /etc/supervisord.conf
COPY docker/start-app.sh /usr/local/bin/start-app
COPY docker/production/nginx.conf /etc/nginx/http.d/default.conf
COPY docker/production/supervisord.conf /etc/supervisord.conf
COPY docker/production/start-app.sh /usr/local/bin/start-app
# Set proper permissions
RUN chown -R www-data:www-data storage bootstrap/cache public/build \

View file

@ -16,8 +16,10 @@ until php artisan tinker --execute="DB::connection()->getPdo();" 2>/dev/null; do
done
echo "Database is ready!"
# Generate app key if not set
php artisan key:generate --force
# Generate app key only if not already set
if ! grep -q "APP_KEY=base64:" /var/www/html/.env 2>/dev/null; then
php artisan key:generate --force
fi
# Laravel optimizations
php artisan config:cache