-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
51 lines (36 loc) · 1.53 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
FROM php:8.1-cli AS builder
# install composer to /composer.phar
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
RUN php composer-setup.php
RUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash -
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -yq \
zlib1g-dev libpng-dev libjpeg-dev libzip-dev \
git \
unzip \
nodejs
RUN docker-php-ext-install gd && \
docker-php-ext-install zip
# copy app sources
COPY / /app
WORKDIR /app
RUN php /composer.phar install
RUN npm -g install yarn
RUN yarn install
RUN yarn build
#------------------------------------------------------------------------------
FROM php:8.1-apache
ENV APACHE_DOCUMENT_ROOT /app/public
RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf && \
sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf && \
sed -ri -e 's!Options Indexes FollowSymLinks!FallbackResource /index.php!' /etc/apache2/apache2.conf
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" && \
echo 'date.timezone = "Europe/Berlin"' > $PHP_INI_DIR/conf.d/timezone.ini && \
echo 'variables_order = "GPCSE"' > $PHP_INI_DIR/conf.d/variables-order.ini
COPY --from=builder /app /app
WORKDIR /app
RUN bin/console doctrine:database:create -n && \
bin/console doctrine:schema:create -n && \
bin/console doctrine:fixtures:load -n
ENV APP_ENV=prod
RUN bin/console cache:warmup -n && \
chown -R www-data. var/ public/logos/