-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile.prod
39 lines (30 loc) · 1.27 KB
/
Dockerfile.prod
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
FROM composer:latest as build
COPY . /app/
RUN composer install --prefer-dist --no-dev --optimize-autoloader --no-interaction --ignore-platform-req=ext-ldap
FROM php:8.2-apache as production
ENV APP_ENV=production
ENV APP_DEBUG=false
RUN apt-get update && \
apt-get install -y \
libldap2-dev \
libldb-dev && \
ln -s /usr/lib/x86_64-linux-gnu/libldap.so /usr/lib/libldap.so && \
ln -s /usr/lib/x86_64-linux-gnu/liblber.so /usr/lib/liblber.so
RUN docker-php-ext-configure opcache --enable-opcache && \
docker-php-ext-install pdo pdo_mysql ldap
COPY docker/php/conf.d/opcache.ini /usr/local/etc/php/conf.d/opcache.ini
COPY --from=build /app /var/www/html
COPY docker/000-default.conf /etc/apache2/sites-available/000-default.conf
VOLUME ["/var/www/html/conf.d"]
RUN mkdir /var/www/html/conf.d && \
cp /var/www/html/.env.example /var/www/html/conf.d/.env && \
ln -s /var/www/html/conf.d/.env /var/www/html/.env && \
chmod 777 -R /var/www/html/storage/ && \
chown -R www-data:www-data /var/www/ && \
a2enmod rewrite
CMD if [ $(cat /var/www/html/conf.d/.env | grep -Po '(?<=APP_KEY=).*' | wc -c) -eq 0 ]; then \
php artisan key:generate; \
fi && \
php artisan config:cache && \
php artisan route:cache && \
apache2-foreground