-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.Prod
59 lines (44 loc) · 2.21 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
FROM --platform=linux/amd64 node:14 as frontend
COPY . /var/www/html
WORKDIR /var/www/html/themes/base
COPY /themes/base/package.json /themes/base/yarn.lock ./
RUN yarn install && yarn build
RUN rm -rf node_modules/ && rm -rf /var/lib/apt/lists/*
FROM composer:2.1.11 as vendor
COPY composer.json composer.json
COPY composer.lock composer.lock
COPY ./public ./public
RUN composer install \
--ignore-platform-reqs \
--no-interaction
RUN mkdir /app/public/assets && chmod 777 /app/public/assets
FROM ubuntu:jammy
# Installations
ENV TZ=Pacific/Auckland
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# Installing syslog-ng
RUN wget -qO - https://ose-repo.syslog-ng.com/apt/syslog-ng-ose-pub.asc | apt-key add - \
echo "deb https://ose-repo.syslog-ng.com/apt/ stable ubuntu-focal" | tee -a /etc/apt/sources.list.d/syslog-ng-ose.list
RUN DEBIAN_FRONTEND="noninteractive" \
apt-get update && apt-get install -y software-properties-common && add-apt-repository ppa:ondrej/php \
&& apt install -y apache2 cron libapache2-mod-php7.4 \
php7.4 php7.4-bcmath php7.4-mysql php7.4-intl php7.4-json php7.4-gd php7.4-soap php7.4-tidy php7.4-zip \
php7.4-gmp php7.4-opcache php7.4-curl php7.4-simplexml php7.4-mbstring php7.4-redis \
syslog-ng-core \
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# This command needed when creating Docker image from M1 chip computer
RUN echo "Mutex posixsem" >> /etc/apache2/apache2.conf
# Apache / PHP configuration
ENV DOCUMENT_ROOT /var/www/html
COPY 000-default.conf /etc/apache2/sites-available/000-default.conf
RUN rm /var/www/html/index.html
RUN a2enmod rewrite ssl
RUN sed -i 's/upload_max_filesize.*/upload_max_filesize = 8M/; s/memory_limit.*/memory_limit = 512M/' /etc/php/7.4/apache2/php.ini
EXPOSE 80
COPY --from=frontend /var/www/html /var/www/html
COPY --from=vendor /app/vendor/ /var/www/html/vendor/
COPY --from=vendor /app/public/ /var/www/html/public/
RUN chmod +x /var/www/html/init.sh && cp /var/www/html/syslog-ng.conf /etc/syslog-ng/syslog-ng.conf \
&& touch /var/www/html/silverstripe.log && chmod 777 /var/www/html/silverstripe.log
ENV DOCUMENT_ROOT /var/www/html/public
ENTRYPOINT ["/var/www/html/init.sh"]