1- FROM ubuntu:18.04
2- MAINTAINER Jason Gegere <jason@htmlgraphic.com>
1+ # Use a more recent base image
2+ FROM ubuntu:20.04
33
4- ENV OS_LOCALE="en_US.UTF-8"
5- RUN apt update && apt install -y locales && locale-gen ${OS_LOCALE}
6- ENV LANG=${OS_LOCALE} \
4+ # Metadata as defined at http://label-schema.org
5+ LABEL org.label-schema.name="Apache Docker" \
6+ org.label-schema.description="Docker container running Apache on Ubuntu with Composer, Laravel, TDD via Shippable & CircleCI" \
7+ org.label-schema.url="https://htmlgraphic.com" \
8+ org.label-schema.vcs-url="https://github.com/htmlgraphic/Apache" \
9+ org.label-schema.vendor="HTMLgraphic, LLC" \
10+ org.label-schema.schema-version="1.0"
11+
12+ # Set non-interactive environment variables
13+ ENV DEBIAN_FRONTEND=noninteractive \
14+ TERM=xterm \
15+ OS_LOCALE="en_US.UTF-8" \
16+ LANG=${OS_LOCALE} \
717 LANGUAGE=${OS_LOCALE} \
8- LC_ALL=${OS_LOCALE} \
9- DEBIAN_FRONTEND=noninteractive
10-
11- # Install packages then remove cache package list information
12- RUN BUILD_DEPS='software-properties-common' \
13- && dpkg-reconfigure locales \
14- && apt install -y $BUILD_DEPS \
15- && add-apt-repository -y ppa:ondrej/php \
16- && add-apt-repository -y ppa:deadsnakes/ppa
17-
18- RUN apt update && apt install -y python3.7 curl apache2 libsasl2-modules libapache2-mod-php7.4 libmcrypt-dev php7.4-cli php7.4-dev php7.4-readline php7.4-mbstring php7.4-zip php7.4-intl php7.4-xml php7.4-bcmath php7.4-xmlrpc php7.4-json php7.4-curl php7.4-gd php7.4-pgsql php7.4-mysql php-pear \
19- && apt update && apt install -yq --no-install-recommends \
18+ LC_ALL=${OS_LOCALE}
19+
20+ # Update and install locales
21+ RUN apt-get update && apt-get install -y locales && locale-gen ${OS_LOCALE}
22+
23+ # Install required packages
24+ RUN apt-get install -y \
25+ software-properties-common \
26+ python3.7 \
27+ curl \
28+ unzip \
29+ p7zip-full \
30+ apache2 \
31+ libsasl2-modules \
32+ libapache2-mod-php7.4 \
33+ libmcrypt-dev \
34+ php7.4-cli \
35+ php7.4-dev \
36+ php7.4-readline \
37+ php7.4-mbstring \
38+ php7.4-zip \
39+ php7.4-intl \
40+ php7.4-xml \
41+ php7.4-bcmath \
42+ php7.4-xmlrpc \
43+ php7.4-json \
44+ php7.4-curl \
45+ php7.4-gd \
46+ php7.4-pgsql \
47+ php7.4-mysql \
2048 git \
2149 cron \
2250 ghostscript \
@@ -33,89 +61,62 @@ RUN apt update && apt install -y python3.7 curl apache2 libsasl2-modules libapac
3361 vim \
3462 wget \
3563 postfix \
36- && apt purge -y --auto-remove $BUILD_DEPS \
37- && apt autoremove -y \
38- && rm -rf /var/lib/apt/lists/* \
39- && pecl channel-update pecl.php.net \
64+ && apt-get autoremove -y \
65+ && apt-get clean \
66+ && rm -rf /var/lib/apt/lists/*
67+
68+ # Install additional packages from PPA
69+ RUN add-apt-repository -y ppa:ondrej/php \
70+ && add-apt-repository -y ppa:deadsnakes/ppa \
71+ && apt-get update && apt-get install -y
72+
73+ # Install and configure pecl extensions
74+ RUN pecl channel-update pecl.php.net \
4075 && pecl install mcrypt-1.0.3 \
4176 && pecl install redis -y
4277
43- # POSTFIX
44- RUN update-locale LANG=en_US.UTF-8
78+ # Enable Apache mods.
79+ RUN a2enmod userdir rewrite ssl
4580
46- # Copy files to build app, add coming page to root apache dir, include self
47- # signed SHA256 certs, unit tests to check over the setup
48- RUN mkdir -p /opt
81+ # Copy files to build app, initial web configs, coming soon page ...
4982COPY ./app /opt/app
5083COPY ./tests /opt/tests
5184
52- # Unit tests run via build_tests.sh
53- RUN tar xf /opt/tests/shunit2-2.1.7.tar.gz -C /opt/tests/
54-
55- # SUPERVISOR
85+ # Supervisor setup
5686RUN chmod -R 755 /opt/* \
5787 && mkdir -p /var/log/supervisor \
5888 && cp /opt/app/supervisord /etc/supervisor/conf.d/supervisord.conf
5989
60- # COMPOSER v2
61- COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
62- RUN composer self-update --2
63- RUN composer global require "laravel/installer"
64- RUN composer global require "vlucas/phpdotenv"
65-
66- # WP-CLI
67- RUN curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar && chmod +x wp-cli.phar && mv wp-cli.phar /usr/local/bin/wp
90+ # Install Mod_pagespeed Module
91+ RUN curl -O https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_amd64.deb \
92+ && dpkg -i mod-pagespeed-stable_current_amd64.deb \
93+ && chown nobody:www-data /var/cache/mod_pagespeed \
94+ && chown nobody:www-data /var/log/pagespeed/
6895
69- # wkhtmltox > HTML > PDF Conversation
70- RUN tar xf /opt/app/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz -C /opt && mv /opt/wkhtmltox/bin/wk* /usr/bin/
71- RUN wkhtmltopdf --version
96+ # Composer v2 installation
97+ COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
98+ RUN composer self-update --2 \
99+ && composer global require "laravel/installer" \
100+ && composer global require "vlucas/phpdotenv"
72101
73- # Enable Apache mods.
74- RUN a2enmod userdir rewrite ssl
102+ # Install WP-CLI
103+ RUN curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar \
104+ && chmod +x wp-cli.phar \
105+ && mv wp-cli.phar /usr/local/bin/wp
75106
76- # Install Mod_pagespeed Module
77- RUN curl -O https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_amd64.deb && dpkg -i mod-pagespeed-stable_current_amd64.deb
78- RUN chown nobody:www-data /var/cache/mod_pagespeed && chown nobody:www-data /var/log/pagespeed/
79-
80-
81- # Environment variables contained within build container.
82- ENV TERM=xterm \
83- LISTEN_PORT=80 \
84- APACHE_RUN_USER=www-data \
85- APACHE_RUN_GROUP=www-data \
86- APACHE_LOG_DIR=/var/log/apache2 \
87- APACHE_LOCK_DIR=/var/lock/apache2 \
88- APACHE_PID_FILE=/var/run/apache2.pid \
89- DOCKERCLOUD_SERVICE_FQDN=$DOCKERCLOUD_SERVICE_FQDN \
90- LOG_TOKEN=$LOG_TOKEN \
91- PATH="~/.composer/vendor/bin:$PATH"
92-
93- # Build-time metadata as defined at http://label-schema.org
94- ARG BUILD_DATE
95- ARG VCS_REF
96- ARG VERSION
97- LABEL org.label-schema.build-date=$BUILD_DATE \
98- org.label-schema.name="Apache Docker" \
99- org.label-schema.description="Docker container running Apache running on Ubuntu, Composer, Lavavel, TDD via Shippable & CircleCI" \
100- org.label-schema.url="https://htmlgraphic.com" \
101- org.label-schema.vcs-ref=$VCS_REF \
102- org.label-schema.vcs-url="https://github.com/htmlgraphic/Apache" \
103- org.label-schema.vendor="HTMLgraphic, LLC" \
104- org.label-schema.version=$VERSION \
105- org.label-schema.schema-version="1.0"
107+ # Install wkhtmltox for HTML to PDF conversion
108+ RUN tar xf /opt/app/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz -C /opt \
109+ && mv /opt/wkhtmltox/bin/wk* /usr/bin/ \
110+ && wkhtmltopdf --version
106111
107- # Add VOLUMEs for persistant data or to allow various
108- # backups of config and databases via --volumes-from
109- # http://bit.ly/autobuild-and-autodeploy
110- VOLUME ["/backup" ]
111- VOLUME ["/data" ]
112- VOLUME ["/etc/letsencrypt" ]
112+ # Unit tests run via build_tests.sh
113+ RUN tar xf /opt/tests/shunit2-2.1.7.tar.gz -C /opt/tests/
113114
115+ # Volumes for persistent data
116+ VOLUME ["/backup" , "/data" , "/etc/letsencrypt" ]
114117
115- # Note that EXPOSE only works for inter-container links. It doesn't make ports
116- # accessible from the host. To expose port(s) to the host, at runtime, use the -p flag.
118+ # Expose ports
117119EXPOSE 80 443
118120
119-
120- # CMD ["/opt/app/run.sh", "env | grep _ >> /etc/environment && supervisord -n"]
121+ # Entrypoint command
121122CMD ["/opt/app/run.sh" ]
0 commit comments