Update docker conf

This commit is contained in:
T'JAMPENS QUENTIN p2406187
2025-11-24 22:16:16 +01:00
parent 1eb75b5782
commit 60d1ec1364
7 changed files with 121 additions and 42 deletions
+46
View File
@@ -0,0 +1,46 @@
version: "3.8"
services:
php:
build:
context: .
dockerfile: ./php/Dockerfile
container_name: app-php
volumes:
- ../:/var/www/app
environment:
- GIT_TOKEN=${GIT_TOKEN}
- GIT_REPO=${GIT_REPO}
depends_on:
- mariadb
nginx:
image: nginx
container_name: app-nginx
volumes:
- ../:/var/www/app
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf
ports:
- "80:80"
depends_on:
- php
mariadb:
image: mariadb:latest
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: laravel
ports:
- "3306:3306"
volumes:
- dbdata:/var/lib/mysql
volumes:
dbdata:
networks:
default:
ipam:
config:
- subnet: 192.168.200.0/24
+28
View File
@@ -0,0 +1,28 @@
#!/bin/sh
APP_DIR=/var/www/app
# Vérifie si le repo existe
if [ ! -d "$APP_DIR/.git" ]; then
echo "📥 Aucun projet trouvé. Clonage..."
git clone https://oauth2:${GIT_TOKEN}@${GIT_REPO} $APP_DIR
else
echo "🔄 Projet existant. Pull..."
cd $APP_DIR
git pull
fi
cd $APP_DIR
# Permissions sur storage et cache
mkdir -p storage bootstrap/cache
chown -R www-data:www-data storage bootstrap/cache
chmod -R 775 storage bootstrap/cache
# Composer & artisan
composer install --no-interaction --prefer-dist
php artisan key:generate --force
php artisan migrate --force
php artisan config:cache
exec php-fpm
+16
View File
@@ -0,0 +1,16 @@
server {
listen 80;
root /var/www/app/public;
index index.php index.html;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
fastcgi_pass php:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
+19
View File
@@ -0,0 +1,19 @@
FROM php:8.4-fpm
# Install dependencies
RUN apt-get update && apt-get install -y \
git unzip libzip-dev libpng-dev libonig-dev \
&& docker-php-ext-install pdo_mysql zip
# Install composer
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
# Copy entrypoint
COPY ./entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh
# Working directory
WORKDIR /var/www/app
ENTRYPOINT ["entrypoint.sh"]
CMD ["php-fpm"]