Dockerfile 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. FROM ubuntu:18.04
  2. RUN export DEBIAN_FRONTEND=noninteractive && ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime
  3. RUN apt update && \
  4. apt -y install software-properties-common apt-utils curl gnupg cron git-core && \
  5. add-apt-repository -y ppa:ondrej/php && \
  6. add-apt-repository -y ppa:ondrej/apache2
  7. RUN apt update && apt -y install \
  8. apache2 \
  9. php7.2 \
  10. mod-php7.2 \
  11. php7.2-curl \
  12. php7.2-mbstring \
  13. php7.2-gd \
  14. php7.2-gettext \
  15. php7.2-pdo \
  16. php7.2-pdo-mysql \
  17. php7.2-simplexml \
  18. php7.2-zip
  19. # install nodejs
  20. RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - &&
  21. RUN apt update && apt -y install nodejs
  22. # install yarn
  23. RUN curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
  24. RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
  25. RUN apt update && apt -y install yarn
  26. # install composer
  27. RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
  28. RUN composer global require "hirak/prestissimo:^0.3" --no-suggest --no-progress
  29. # install cron
  30. RUN \
  31. # configure cron tasks
  32. echo '0 * * * * php /var/www/stk-addons/cron/hourly.php >/dev/null 2>&1' > /etc/cron.d/hourly && \
  33. echo '0 2 * * * php /var/www/stk-addons/cron/daily.php >/dev/null 2>&1' > /etc/cron.d/daily && \
  34. echo '0 2 */7 * * php /var/www/stk-addons/cron/weekly.php >/dev/null 2>&1' > /etc/cron.d/weekly
  35. # move configuration from install directory to specific directories
  36. COPY ./install/apache.EXAMPLE.conf /etc/apache2/sites-enabled/stk-addons.conf
  37. COPY ./install/htaccess.EXAMPLE /var/www/stk-addons/.htaccess
  38. COPY ./install/config.EXAMPLE.php /var/www/stk-addons/config.php
  39. RUN rm /etc/apache2/sites-enabled/000-default.conf
  40. RUN cp /etc/apache2/mods-available/rewrite.* /etc/apache2/mods-enabled/
  41. # switch to document root
  42. WORKDIR /var/www/stk-addons
  43. # copy sources to document root
  44. COPY ./ ./
  45. # owner of document root is apache user
  46. RUN chown -R www-data .
  47. # install composer packages
  48. RUN composer install --no-suggest --no-progress
  49. # install bower packages
  50. RUN yarn install --allow-root
  51. # remove unnecesary directories
  52. RUN rm -rf install
  53. RUN rm -rf packages.json yarn.lock .yarnrc .dockerignore .gitattributes .gitignore .travis.yml composer.* docker-compose.* Dockerfile* phpunit.xml
  54. EXPOSE 80
  55. CMD ["systemctl", "start", "cron"]
  56. CMD ["a2enmod", "rewrite"]
  57. CMD ["apachectl", "-DFOREGROUND"]