-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
executable file
·57 lines (45 loc) · 1.41 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
57
FROM php:8.2-fpm-buster
# Set working directory
WORKDIR /var/www
# Install dependencies
USER root
RUN apt-get update && apt-get install -y \
build-essential \
libzip-dev \
default-mysql-client \
libpng-dev \
libjpeg62-turbo-dev \
libfreetype6-dev \
locales \
zip \
git \
nano \
curl \
libicu-dev \
libonig-dev \
cron \
&& rm -rf /var/lib/apt/lists/*
# Install PHP extensions
RUN docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install gd pdo_mysql mbstring zip exif pcntl
# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
# Install Node.js and npm
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - \
&& apt-get install -y nodejs
# Add user for Laravel application
RUN groupadd -g 1000 www || true \
&& useradd -u 1000 -ms /bin/bash -g www www || true
# Copy existing application directory contents
COPY . /var/www
# Copy existing application directory permissions
COPY --chown=www:www . /var/www
# Add crontab configuration
COPY ./php/crontab /etc/cron.d/laravel-cron
# Set permissions for the cron file
RUN chmod 0644 /etc/cron.d/laravel-cron
# Apply cron job and start cron service
RUN crontab /etc/cron.d/laravel-cron
# Expose port 9000 and start php-fpm server and cron in the same container
EXPOSE 9000
CMD ["sh", "-c", "cron && php-fpm"]