Fix deploy
All checks were successful
Deploy App / build-and-deploy (push) Successful in 2m12s

This commit is contained in:
2025-08-31 02:02:30 +02:00
parent 03e3bda0ce
commit a54308f710
3 changed files with 38 additions and 18 deletions

View File

@@ -54,6 +54,6 @@ jobs:
script: | script: |
cd /var/www/scheduler cd /var/www/scheduler
git pull origin master git pull origin master
docker-compose -f docker-compose.prod.yml pull /usr/lib/docker/cli-plugins/docker-compose -f docker-compose.prod.yml pull
docker-compose -f docker-compose.prod.yml up -d /usr/lib/docker/cli-plugins/docker-compose -f docker-compose.prod.yml up -d
docker-compose -f docker-compose.prod.yml run --rm app php artisan migrate --force /usr/lib/docker/cli-plugins/docker-compose -f docker-compose.prod.yml run --rm app php artisan migrate --force

View File

@@ -1,9 +1,11 @@
FROM php:8.4-fpm # ----------------------------
# Stage 1: PHP + Composer
# ----------------------------
FROM php:8.4-fpm AS php-base
# Set working dir
WORKDIR /var/www/html WORKDIR /var/www/html
# Install system deps # Install system dependencies and PHP extensions
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
git curl libpng-dev libonig-dev libxml2-dev zip unzip \ git curl libpng-dev libonig-dev libxml2-dev zip unzip \
&& docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd && docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd
@@ -14,30 +16,47 @@ COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
# Copy app code # Copy app code
COPY . . COPY . .
# Install PHP deps (no dev) # Install PHP dependencies (no dev)
RUN composer install --no-dev --optimize-autoloader --no-interaction RUN composer install --no-dev --optimize-autoloader --no-interaction
# Node build (optional if you need assets)
# ----------------------------
# Stage 2: Node build
# ----------------------------
FROM node:20 AS frontend FROM node:20 AS frontend
WORKDIR /app WORKDIR /app
# Copy Node dependencies and install # Copy only package files and install Node dependencies
COPY package*.json ./ COPY package*.json ./
RUN npm ci RUN npm ci
# Copy app code # Copy the rest of the app code
COPY . . COPY . .
# Copy vendor from composer stage # Copy vendor from PHP stage (needed if assets reference PHP files)
COPY --from=0 /var/www/html/vendor ./vendor COPY --from=php-base /var/www/html/vendor ./vendor
# Build assets # Build assets
RUN npm run build RUN npm run build
# Copy built assets into PHP image
FROM php:8.4-fpm # ----------------------------
# Stage 3: Final production image
# ----------------------------
FROM php:8.4-fpm AS final
WORKDIR /var/www/html WORKDIR /var/www/html
COPY --from=0 /var/www/html .
# Install system deps and PHP extensions in the final image
RUN apt-get update && apt-get install -y \
git curl libpng-dev libonig-dev libxml2-dev zip unzip \
&& docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd
# Copy PHP code + vendor
COPY --from=php-base /var/www/html .
# Copy built frontend assets
COPY --from=frontend /app/public ./public COPY --from=frontend /app/public ./public
# Fix permissions for Laravel # Fix permissions for Laravel

View File

@@ -1,16 +1,17 @@
services: services:
app: app:
image: git.oskarmikael.com/oskarb/scheduler:latest image: git.oskarmikael.com/oskarb/scheduler:latest
env_file:
- .env
volumes: volumes:
- storage:/var/www/html/storage - storage:/var/www/html/storage
- bootstrap_cache:/var/www/html/bootstrap/cache - bootstrap_cache:/var/www/html/bootstrap/cache
- .env:/var/www/html/.env
networks:
- laravel
nginx: nginx:
image: nginx:1.27 image: nginx:1.27
volumes: volumes:
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro - ../nginx.conf:/etc/nginx/conf.d/default.conf:ro
ports: ports:
- '${APP_PORT:-80}:80' - '${APP_PORT:-80}:80'
depends_on: depends_on: