-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
58 lines (45 loc) · 1.43 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
49
50
51
52
53
54
55
56
# Use an official PHP runtime as a parent image
FROM php:8.2-fpm-alpine
# Install system dependencies
RUN apk update && apk add --no-cache \
freetype-dev \
libjpeg-turbo-dev \
libpng-dev \
libzip-dev \
libxml2-dev \
oniguruma-dev \
linux-headers \
$PHPIZE_DEPS
# Clear the APK cache
RUN rm -rf /var/cache/apk/*
# Set environment variables for Oniguruma
ENV ONIG_CFLAGS="-I/usr/include/oniguruma"
ENV ONIG_LIBS="-L/usr/lib/"
# Configure and install PHP extensions
RUN docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j$(nproc) \
pdo_mysql \
mbstring \
exif \
pcntl \
bcmath \
gd \
zip \
sockets \
opcache
# Install Composer
COPY --from=composer:2.2 /usr/bin/composer /usr/bin/composer
# Copy existing application directory contents
COPY . /var/www
# Copy existing application directory permissions
COPY --chown=www-data:www-data . /var/www
# Set permissions for Laravel
RUN chown -R www-data:www-data /var/www/storage /var/www/bootstrap/cache
# Create a log file for the cron job
RUN touch /var/www/storage/logs/scheduler.log \
&& chmod 777 /var/www/storage/logs/scheduler.log
# Add cron job to execute Laravel scheduler every minute
RUN echo "* * * * * www-data php /var/www/artisan schedule:run >> /var/www/storage/logs/scheduler.log 2>&1" > /etc/crontabs/www-data
# Expose port 9000 and start PHP-FPM server
EXPOSE 9000
CMD ["php-fpm"]