|
1 | | -FROM nginx:bookworm |
| 1 | +FROM php:8.2-fpm |
2 | 2 |
|
3 | | -RUN apt update && apt dist-upgrade -y |
4 | | -RUN apt-get install -y --no-install-recommends \ |
| 3 | +# Installer les extensions PHP nécessaires |
| 4 | +RUN apt-get update && apt-get install -y \ |
5 | 5 | git \ |
6 | | - composer \ |
7 | | - php \ |
8 | | - php-cli \ |
9 | | - php-opcache \ |
| 6 | + cron \ |
| 7 | + nginx \ |
10 | 8 | php-mysql \ |
11 | 9 | php-pgsql \ |
12 | 10 | php-zip \ |
13 | 11 | php-gd \ |
14 | 12 | php-mbstring \ |
15 | 13 | php-curl \ |
16 | 14 | php-xml \ |
17 | | - cron \ |
18 | 15 | && apt-get clean && rm -rf /var/lib/apt/lists/* |
19 | 16 |
|
20 | | -RUN touch /etc/mailname |
21 | | -RUN echo "sender@yourdomain.org" > /etc/mailname |
22 | | -RUN echo "* * * * * root cd /var/www/deming && php artisan schedule:run >> /dev/null 2>&1" >> /etc/crontab |
23 | | -RUN useradd -ms /bin/bash deming |
24 | | -RUN mkdir -p /var/www/deming |
| 17 | +# Installer Composer |
| 18 | +COPY --from=composer:latest /usr/bin/composer /usr/bin/composer |
25 | 19 |
|
| 20 | +# Définir le répertoire de travail |
26 | 21 | WORKDIR /var/www/deming |
27 | 22 |
|
| 23 | +# Cloner le dépôt Git |
28 | 24 | RUN git clone https://www.github.com/dbarzin/deming . |
29 | | -RUN cp docker/deming.conf /etc/nginx/conf.d/default.conf |
30 | | -RUN cp docker/userdemo.sh /etc/userdemo.sh |
| 25 | + |
| 26 | +# Copier les fichiers de configuration |
| 27 | +COPY docker/deming.conf /etc/nginx/conf.d/default.conf |
| 28 | +COPY docker/userdemo.sh /etc/userdemo.sh |
31 | 29 | COPY docker/resetdb.sh /etc/resetdb.sh |
32 | | -RUN cp docker/uploadiso27001db.sh /etc/uploadiso27001db.sh |
| 30 | +COPY docker/uploadiso27001db.sh /etc/uploadiso27001db.sh |
33 | 31 | COPY docker/initialdb.sh /etc/initialdb.sh |
34 | | -RUN chmod +x /etc/*.sh |
35 | | -RUN mkdir -p storage/framework/views && mkdir -p storage/framework/cache && mkdir -p storage/framework/sessions && mkdir -p bootstrap/cache |
36 | | -RUN chmod -R 775 /var/www/deming/storage && chown -R www-data:www-data /var/www/deming |
| 32 | +COPY docker/entrypoint.sh /opt/entrypoint.sh |
| 33 | + |
| 34 | +# Rendre les scripts exécutables |
| 35 | +RUN chmod +x /etc/*.sh /opt/entrypoint.sh |
| 36 | + |
| 37 | +# Configurer les permissions |
| 38 | +RUN mkdir -p storage/framework/views storage/framework/cache storage/framework/sessions bootstrap/cache |
| 39 | +RUN chmod -R 775 storage bootstrap/cache |
| 40 | +RUN chown -R www-data:www-data storage bootstrap/cache |
| 41 | + |
| 42 | +# Installer les dépendances PHP |
37 | 43 | RUN composer install |
38 | 44 | RUN php artisan vendor:publish --all |
39 | 45 |
|
| 46 | +# Configurer le fichier .env |
40 | 47 | RUN cp .env.example .env |
41 | 48 | RUN sed -i 's/DB_HOST=127\.0\.0\.1/DB_HOST=mysql/' .env |
42 | 49 |
|
43 | | -COPY docker/entrypoint.sh /opt/entrypoint.sh |
44 | | -RUN chmod u+x /opt/entrypoint.sh |
45 | | - |
| 50 | +# Exposer le port 80 |
46 | 51 | EXPOSE 80 |
47 | 52 |
|
| 53 | +# Démarrer Nginx et PHP-FPM |
48 | 54 | ENTRYPOINT ["/opt/entrypoint.sh"] |
| 55 | +CMD ["nginx", "-g", "daemon off;"] |
0 commit comments