|
1 | | -FROM amazonlinux:latest |
| 1 | +FROM bankrate/docker-php:1.0 |
2 | 2 |
|
3 | | -# Set some labels so the Docker image has some useful metadata. |
4 | | -LABEL description="Bankrate Standard PHP Base" |
5 | | -LABEL maintainer="Steven Crothers <steven.crothers@bankrate.com>" |
6 | | - |
7 | | -# Setup some environment variables for later usage. |
8 | | -ENV PHP_INI_DIR "/etc/php.d" |
9 | | -ENV PHP_FPM_DIR "/etc/php-fpm.d" |
10 | | - |
11 | | -# Set required Composer settings. |
12 | | -ENV COMPOSER_ALLOW_SUPERUSER 1 |
13 | | -ENV COMPOSER_VERSION 1.5.2 |
14 | | - |
15 | | -# Set system environment variables for the container. |
16 | | -ENV PATH="/root/.composer/vendor/bin:${PATH}" |
17 | | - |
18 | | -# Update the container fully for security. |
19 | | -RUN /usr/bin/yum update -y && \ |
20 | | - /usr/bin/yum clean all |
21 | | - |
22 | | -# Install dependancies for Composer and such. |
23 | | -RUN /usr/bin/yum install -y \ |
24 | | - curl \ |
25 | | - git \ |
26 | | - subversion \ |
27 | | - openssh \ |
28 | | - openssl \ |
29 | | - mercurial \ |
30 | | - tini \ |
31 | | - wget \ |
32 | | - zlib \ |
33 | | - zlib-devel && \ |
34 | | - /usr/bin/yum clean all |
35 | | - |
36 | | -# Install PHP 7.1. |
37 | | -RUN /usr/bin/yum install -y \ |
38 | | - php71 \ |
39 | | - php71-bcmath \ |
40 | | - php71-cli \ |
41 | | - php71-common \ |
42 | | - php71-dba \ |
43 | | - php71-embedded \ |
44 | | - php71-enchant \ |
45 | | - php71-fpm \ |
46 | | - php71-gd \ |
47 | | - php71-gmp \ |
48 | | - php71-imap \ |
49 | | - php71-intl \ |
50 | | - php71-json \ |
51 | | - php71-ldap \ |
52 | | - php71-mbstring \ |
53 | | - php71-mcrypt \ |
54 | | - php71-mysqlnd \ |
55 | | - php71-odbc \ |
56 | | - php71-opcache \ |
57 | | - php71-pdo \ |
58 | | - php71-pdo-dblib \ |
59 | | - php71-pecl-oauth \ |
60 | | - php71-pecl-redis \ |
61 | | - php71-pecl-ssh2 \ |
62 | | - php71-pgsql \ |
63 | | - php71-process \ |
64 | | - php71-recode \ |
65 | | - php71-snmp \ |
66 | | - php71-xml \ |
67 | | - php71-xmlrpc && \ |
68 | | - /usr/bin/yum clean all |
69 | | - |
70 | | -# Setup a PHP memory limit and timezone for Composer. |
71 | | -RUN echo "memory_limit=-1" > "$PHP_INI_DIR/memory-limit.ini" && \ |
72 | | - echo "date.timezone=UTC" > "$PHP_INI_DIR/date_timezone.ini" |
73 | | - |
74 | | -# Install Composer on the system. |
75 | | -RUN /usr/bin/curl -o /usr/local/bin/composer \ |
76 | | - "https://getcomposer.org/download/$COMPOSER_VERSION/composer.phar" && \ |
77 | | - /bin/chmod 755 /usr/local/bin/composer |
78 | | - |
79 | | -# Globally install PHP Unit for testing purposes. |
80 | | -RUN /usr/local/bin/composer global require phpunit/phpunit |
81 | | - |
82 | | -# Create the app directory to install our code into and set as working directory. |
83 | | -RUN /bin/mkdir /app |
84 | | -WORKDIR /app |
85 | | - |
86 | | -# Add our environment files for the container. |
87 | | -ADD files/bash_profile /root/.bash_profile |
88 | | -ADD files/bashrc /root/.bashrc |
89 | | -ADD files/prompt.sh /etc/profile.d/prompt.sh |
90 | | - |
91 | | -# Install confd for configuration creation. |
92 | | -RUN /usr/bin/curl -L -o /usr/local/bin/confd \ |
93 | | - "https://github.com/kelseyhightower/confd/releases/download/v0.14.0/confd-0.14.0-linux-amd64" && \ |
94 | | - /bin/chmod 755 /usr/local/bin/confd && \ |
95 | | - /bin/mkdir /etc/confd |
96 | | - |
97 | | -# Install the confd configuration file. |
98 | | -ADD files/confd.toml /etc/confd/confd.toml |
99 | | - |
100 | | -# Install supervisord for process management. |
101 | | -RUN /usr/bin/yum install -y python27-pip && \ |
102 | | - /usr/bin/yum clean all && \ |
103 | | - /usr/bin/easy_install supervisor |
104 | | - |
105 | | -# Install Nginx for the web frontend. |
106 | | -RUN /usr/bin/yum install -y nginx && \ |
107 | | - /usr/bin/yum clean all |
108 | | - |
109 | | -# Default configuration settings. |
110 | | -ENV APP_USER "app" |
111 | | -ENV APP_GROUP "app" |
112 | | -ENV NGINX_WEB_PORT 8080 |
113 | | -ENV NGINX_WEB_ROOT "/app" |
114 | | -ENV PHP_MAX_PROCS 2 |
115 | | -ENV PHP_FPM_PORT 9000 |
116 | | -ENV PHP_SECRET_KEY "cfc05035528bde5c6aabe7a8a7945715" |
117 | | - |
118 | | -# Create the app system user for the container. |
119 | | -RUN /usr/sbin/useradd \ |
120 | | - --comment "Application User" \ |
121 | | - --home-dir /app \ |
122 | | - --no-create-home \ |
123 | | - --system \ |
124 | | - --shell /sbin/nologin \ |
125 | | - app |
126 | | - |
127 | | -# Install configuration files. |
128 | | -RUN /bin/mkdir /etc/confd/templates && \ |
129 | | - /bin/mkdir /etc/confd/conf.d && \ |
130 | | - /bin/mkdir /var/log/supervisor && \ |
131 | | - /bin/chown app:app /var/log/supervisor |
132 | | -ADD configs/templates/nginx.toml /etc/confd/conf.d/nginx.toml |
133 | | -ADD configs/templates/php-fpm.toml /etc/confd/conf.d/php-fpm.toml |
134 | | -ADD configs/templates/supervisord.toml /etc/confd/conf.d/supervisord.toml |
135 | | -ADD configs/nginx.tmpl /etc/confd/templates/nginx.tmpl |
136 | | -ADD configs/php-fpm.tmpl /etc/confd/templates/php-fpm.tmpl |
137 | | -ADD configs/supervisord.tmpl /etc/confd/templates/supervisord.tmpl |
138 | | - |
139 | | -# Setup our entrypoint into the container. |
140 | | -ADD entrypoint /usr/local/bin/entrypoint |
141 | | -RUN /bin/chmod 755 /usr/local/bin/entrypoint |
142 | | -ENTRYPOINT ["/usr/local/bin/entrypoint"] |
143 | | - |
144 | | -# Expose the port to the Docker engine. |
145 | | -EXPOSE 8080 |
| 3 | +# Add the composer automatic installer script. |
| 4 | +ADD scripts/composer.sh /usr/local/bin/composer.sh |
146 | 5 |
|
147 | 6 | # Create the on build actions for this container. |
148 | 7 | ONBUILD ADD . /app/ |
| 8 | +ONBUILD RUN /bin/bash /usr/local/bin/composer.sh |
149 | 9 | ONBUILD RUN /bin/chown -R app:app /app |
0 commit comments