-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
48 lines (37 loc) · 1.25 KB
/
Dockerfile
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
# Use official PHP image for Laravel
FROM php:8.3-fpm
# Install system dependencies
RUN apt-get update && apt-get install -y \
git \
curl \
zip \
unzip \
libpng-dev \
libonig-dev \
libxml2-dev \
libzip-dev \
npm \
nodejs \
supervisor
# Install PHP extensions
RUN docker-php-ext-install pdo mbstring exif pcntl bcmath gd zip
# Install Composer
COPY --from=composer:2.7.9 /usr/bin/composer /usr/bin/composer
# Set working directory
WORKDIR /var/www
# Copy project files
COPY . .
# Install Laravel dependencies
RUN composer install
# Install Node.js dependencies for React
RUN npm install
# Expose Laravel port
EXPOSE 8000
# Expose React port
EXPOSE 5173
# Create Supervisor configuration for both Laravel and React
RUN echo '[supervisord]\nnodaemon=true\n' > /etc/supervisord.conf && \
echo '[program:laravel]\ncommand=php artisan serve --host=0.0.0.0 --port=8000\ndirectory=/var/www\nautostart=true\nautorestart=true\n' >> /etc/supervisord.conf && \
echo '[program:react]\ncommand=npm run dev --prefix /var/www\ndirectory=/var/www\nautostart=true\nautorestart=true\n' >> /etc/supervisord.conf
# Start Supervisor to run both Laravel and React with hot-reload
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]