-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
48 lines (38 loc) · 1.89 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
FROM ubuntu:22.04
WORKDIR /var/www/html
ARG SERVER_NAME
ARG APT_PACKAGES
ARG DEBIAN_FRONTEND=noninteractive
# install dependencies
RUN apt-get update
RUN apt-get install -y software-properties-common
RUN add-apt-repository ppa:ondrej/php
RUN apt-get remove -y --purge software-properties-common
RUN apt-get update && apt-get upgrade -y
RUN apt-get install -y cron curl php7.4 php7.4-cli php7.4-curl php7.4-mysql php7.4-xml php7.4-xml php7.4-mbstring apache2 libapache2-mod-php7.4
RUN apt-get install -y ${APT_PACKAGES}
# install composer
RUN apt-get install -y unzip
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
RUN php -r "if (hash_file('sha384', 'composer-setup.php') === 'dac665fdc30fdd8ec78b38b9800061b4150413ff2e3b6f88543c636f7cd84f6db9189d43a81e5503cda447da73c7e5b6') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
RUN php composer-setup.php
RUN php -r "unlink('composer-setup.php');"
RUN mv composer.phar /usr/local/bin/composer
# setup apache
RUN a2enmod rewrite expires headers ssl
RUN a2dissite 000-default.conf
RUN rm /var/www/html/index.html
# setup source files
COPY . .
RUN COMPOSER_ALLOW_SUPERUSER=1 composer install
RUN mkdir -p cache demos sessions /etc/apache2/ssl
RUN chown -R www-data:www-data .
# enable site
RUN ln -s /etc/apache2/sites-available/${SERVER_NAME}.conf /etc/apache2/sites-enabled/${SERVER_NAME}.conf
RUN echo 'ServerName localhost' >> /etc/apache2/apache2.conf
# enable cron jobs
RUN echo '*/1 * * * * www-data curl -Lk localhost/api/refreshCache.php > /dev/null 2>&1' > /etc/cron.d/board
#RUN echo '*/5 * * * * www-data curl -Lk localhost/api/fetchNewScores.php > /dev/null 2>&1' >> /etc/cron.d/board
#RUN echo '0 0 */4 * * www-data php -f /var/www/html/util/fetchImportantProfileData.php > /dev/null 2>&1' >> /etc/cron.d/board
EXPOSE 80 443
CMD service cron start && apachectl -D FOREGROUND