-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
executable file
·50 lines (33 loc) · 1.42 KB
/
Dockerfile
File metadata and controls
executable file
·50 lines (33 loc) · 1.42 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
# Use official PHP image with required extensions
FROM php:8.2-fpm
# Set working directory inside the container
WORKDIR /var/www/html
# Install system dependencies
RUN apt-get update && apt-get install -y \
supervisor zip unzip curl libicu-dev libpng-dev libjpeg-dev libfreetype6-dev \
libonig-dev git libxml2-dev libzip-dev \
&& docker-php-ext-configure gd \
&& docker-php-ext-install gd mbstring zip intl opcache pdo_mysql
# Clear cache
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
# Install Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# Copy existing project files
COPY . /var/www/html
# Set proper permissions for Laravel storage and cache directories
RUN chown -R www-data:www-data /var/www/html
RUN mkdir -p /var/www/html/storage /var/www/html/bootstrap/cache
RUN chown -R www-data:www-data /var/www/html/storage /var/www/html/bootstrap/cache
RUN chmod -R 775 /var/www/html/storage /var/www/html/bootstrap/cache
# Install Laravel dependencies
RUN composer install --no-dev --prefer-dist
# Create Supervisor configuration directory
RUN mkdir -p /etc/supervisor/conf.d
# Copy Supervisor configuration for Laravel queues
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
# Ensure logs directory exists
RUN mkdir -p /var/log && touch /var/log/laravel-worker.log
# Expose port
EXPOSE 9000
# Start Supervisor
CMD [ "supervisord", "-n", "-c", "/etc/supervisor/supervisord.conf"]