-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
84 lines (65 loc) · 2.17 KB
/
Dockerfile
File metadata and controls
84 lines (65 loc) · 2.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# Dockerfile pour Laravel 11 + Vue 3 avec Vite
FROM php:8.3-fpm
# Arguments
ARG user=formacube
ARG uid=1000
# Installation des dépendances système
RUN apt-get update && apt-get install -y \
git \
curl \
libpng-dev \
libonig-dev \
libxml2-dev \
libzip-dev \
libfreetype6-dev \
libjpeg62-turbo-dev \
libicu-dev \
zip \
unzip \
supervisor \
nginx \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Installation des extensions PHP
RUN docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd zip intl
# Installation de Redis extension
RUN pecl install redis && docker-php-ext-enable redis
# Installation de Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# Installation de Node.js 20 LTS
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
&& apt-get install -y nodejs \
&& npm install -g npm@latest
# Création de l'utilisateur système
RUN useradd -G www-data,root -u $uid -d /home/$user $user \
&& mkdir -p /home/$user/.composer \
&& chown -R $user:$user /home/$user
# Configuration PHP
COPY docker/php/php.ini /usr/local/etc/php/conf.d/custom.ini
# Configuration Nginx
COPY docker/nginx/nginx.conf /etc/nginx/nginx.conf
COPY docker/nginx/default.conf /etc/nginx/conf.d/default.conf
# Configuration Supervisor
COPY docker/supervisor/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
# Définir le répertoire de travail
WORKDIR /var/www
# Copier les fichiers du projet
COPY --chown=$user:www-data . /var/www
# Définir les permissions
RUN chown -R $user:www-data /var/www \
&& chmod -R 775 /var/www/storage \
&& chmod -R 775 /var/www/bootstrap/cache
# Installer les dépendances PHP
USER $user
RUN composer install --no-interaction --prefer-dist --optimize-autoloader
# Installer les dépendances Node et build
RUN npm install && npm run build
USER root
# Exposer le port
EXPOSE 80
# Script d'entrée
COPY docker/entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh
ENTRYPOINT ["entrypoint.sh"]
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]