-
Notifications
You must be signed in to change notification settings - Fork 28
/
Dockerfile
74 lines (57 loc) · 2.44 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
FROM ubuntu:18.04
RUN export DEBIAN_FRONTEND=noninteractive && ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime
RUN apt update && \
apt -y install software-properties-common apt-utils curl gnupg cron git-core && \
add-apt-repository -y ppa:ondrej/php && \
add-apt-repository -y ppa:ondrej/apache2
RUN apt update && apt -y install \
apache2 \
php7.2 \
mod-php7.2 \
php7.2-curl \
php7.2-mbstring \
php7.2-gd \
php7.2-gettext \
php7.2-pdo \
php7.2-pdo-mysql \
php7.2-simplexml \
php7.2-zip
# install nodejs
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - &&
RUN apt update && apt -y install nodejs
# install yarn
RUN curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
RUN apt update && apt -y install yarn
# install composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN composer global require "hirak/prestissimo:^0.3" --no-suggest --no-progress
# install cron
RUN \
# configure cron tasks
echo '0 * * * * php /var/www/stk-addons/cron/hourly.php >/dev/null 2>&1' > /etc/cron.d/hourly && \
echo '0 2 * * * php /var/www/stk-addons/cron/daily.php >/dev/null 2>&1' > /etc/cron.d/daily && \
echo '0 2 */7 * * php /var/www/stk-addons/cron/weekly.php >/dev/null 2>&1' > /etc/cron.d/weekly
# move configuration from install directory to specific directories
COPY ./install/apache.EXAMPLE.conf /etc/apache2/sites-enabled/stk-addons.conf
COPY ./install/htaccess.EXAMPLE /var/www/stk-addons/.htaccess
COPY ./install/config.EXAMPLE.php /var/www/stk-addons/config.php
RUN rm /etc/apache2/sites-enabled/000-default.conf
RUN cp /etc/apache2/mods-available/rewrite.* /etc/apache2/mods-enabled/
# switch to document root
WORKDIR /var/www/stk-addons
# copy sources to document root
COPY ./ ./
# owner of document root is apache user
RUN chown -R www-data .
# install composer packages
RUN composer install --no-suggest --no-progress
# install bower packages
RUN yarn install --allow-root
# remove unnecesary directories
RUN rm -rf install
RUN rm -rf packages.json yarn.lock .yarnrc .dockerignore .gitattributes .gitignore .travis.yml composer.* docker-compose.* Dockerfile* phpunit.xml
EXPOSE 80
CMD ["systemctl", "start", "cron"]
CMD ["a2enmod", "rewrite"]
CMD ["apachectl", "-DFOREGROUND"]