ci with frankenPhp
This commit is contained in:
parent
a9c267e878
commit
ef7f566acf
54
Dockerfile
54
Dockerfile
|
|
@ -1,36 +1,40 @@
|
|||
FROM laravelsail/php84-composer AS build
|
||||
|
||||
# --- Étape de Build ---
|
||||
FROM composer:2.7 AS build
|
||||
WORKDIR /var/www/html
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN apt-get update && apt-get install -y libicu-dev \
|
||||
&& docker-php-ext-configure intl \
|
||||
&& docker-php-ext-install intl
|
||||
|
||||
RUN composer install --no-dev --no-interaction --prefer-dist --optimize-autoloader
|
||||
|
||||
FROM laravelsail/php84-composer
|
||||
# --- Étape Finale (Production) ---
|
||||
FROM dunglas/frankenphp:1.3-php8.4-alpine
|
||||
|
||||
# Installation des dépendances système pour Postgres et GD
|
||||
RUN apk add --no-cache \
|
||||
libpq-dev \
|
||||
libpng-dev \
|
||||
libjpeg-turbo-dev \
|
||||
freetype-dev \
|
||||
icu-dev
|
||||
|
||||
# Installation des extensions PHP
|
||||
RUN install-php-extensions \
|
||||
intl \
|
||||
pdo_pgsql \
|
||||
gd \
|
||||
zip \
|
||||
opcache
|
||||
|
||||
WORKDIR /var/www/html
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
libicu-dev \
|
||||
libpq-dev \
|
||||
libpng-dev \
|
||||
libjpeg-dev \
|
||||
libfreetype6-dev \
|
||||
file \
|
||||
&& docker-php-ext-configure intl \
|
||||
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
|
||||
&& docker-php-ext-install intl pdo_pgsql gd fileinfo \
|
||||
&& docker-php-ext-enable pdo_pgsql gd fileinfo
|
||||
# Copie des fichiers depuis le build
|
||||
COPY --from=build /var/www/html /var/www/html
|
||||
|
||||
RUN php artisan storage:link
|
||||
# Variables d'environnement pour Laravel
|
||||
ENV APP_ENV=production
|
||||
ENV APP_RUNTIME=Laravel\FrankenPHP\Runtime
|
||||
ENV MAX_REQUESTS=500
|
||||
|
||||
ENTRYPOINT []
|
||||
# Droits d'accès pour le stockage
|
||||
RUN chown -R www-data:www-data /var/www/html/storage /var/www/html/bootstrap/cache
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
CMD ["sh", "-c", "php artisan migrate --force && php artisan serve --host=0.0.0.0 --port=80"]
|
||||
# Commande de démarrage
|
||||
CMD ["sh", "-c", "php artisan migrate --force && php artisan storage:link && frankenphp run --config /etc/caddy/Caddyfile"]
|
||||
|
|
|
|||
|
|
@ -1,18 +1,21 @@
|
|||
services:
|
||||
starter-api:
|
||||
# REMPLACE par ton URL Gitea réelle
|
||||
image: gitea.leonmorival.com/leon-morival/laravel-starter:latest
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
container_name: starter-starter-api-1
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
pgsql:
|
||||
condition: service_healthy
|
||||
ports:
|
||||
- "8002:80"
|
||||
# ports: <--- Supprimé pour la sécurité, NPM s'en occupe
|
||||
# - "8002:80"
|
||||
environment:
|
||||
APP_ENV: "production" # Changé de local à production
|
||||
APP_ENV: "production"
|
||||
APP_KEY: "${APP_KEY}"
|
||||
APP_URL: "${APP_URL}"
|
||||
APP_DEBUG: "false" # Sécurité : false en prod
|
||||
APP_RUNTIME: "Laravel\\FrankenPHP\\Runtime" # <-- AJOUTÉ pour FrankenPHP
|
||||
APP_DEBUG: "false"
|
||||
FILESYSTEM_DISK: "public"
|
||||
DB_CONNECTION: "pgsql"
|
||||
DB_HOST: "pgsql"
|
||||
|
|
@ -28,16 +31,17 @@ services:
|
|||
- internal
|
||||
|
||||
pgsql:
|
||||
image: postgres:15-alpine # Attention: postgres 18 n'existe pas encore (17 max), 15 est stable
|
||||
image: postgres:18-alpine
|
||||
container_name: starter-pgsql-1
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_DB: "${DB_DATABASE}"
|
||||
POSTGRES_USER: "${DB_USERNAME}"
|
||||
POSTGRES_PASSWORD: "${DB_PASSWORD}"
|
||||
volumes:
|
||||
- pgsql-data:/var/lib/postgresql/data # Ajout de /data pour la persistance correcte
|
||||
ports:
|
||||
- "5428:5432"
|
||||
- pgsql-data:/var/lib/postgresql/data
|
||||
# ports: <--- Tu peux aussi le supprimer si tu n'as pas besoin d'y accéder depuis ton PC (DBeaver/TablePlus)
|
||||
# - "5428:5432"
|
||||
healthcheck:
|
||||
test: [ "CMD-SHELL", "pg_isready -U ${DB_USERNAME} -d ${DB_DATABASE}" ]
|
||||
interval: 5s
|
||||
|
|
|
|||
Loading…
Reference in New Issue