forked from appserver-io/appserver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
105 lines (70 loc) · 3.81 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
################################################################################
# Dockerfile for appserver.io main Docker distribution
################################################################################
# base image
FROM debian:jessie
# author
MAINTAINER Tim Wagner <tw@appserver.io>
################################################################################
# define versions
ENV APPSERVER_RUNTIME_BUILD_VERSION 1.1.7-45
# update the sources list
RUN apt-get update \
# install the necessary packages
&& DEBIAN_FRONTEND=noninteractive apt-get install supervisor wget git vim -y python-pip \
# install the Python package to redirect the supervisord output
&& pip install supervisor-stdout
################################################################################
# download runtime in specific version
RUN wget -O /tmp/appserver-runtime.deb \
http://builds.appserver.io/linux/debian/8/appserver-runtime_${APPSERVER_RUNTIME_BUILD_VERSION}~deb8_amd64.deb \
# install runtime
&& dpkg -i /tmp/appserver-runtime.deb; exit 0
# install missing runtime dependencies
RUN apt-get install -yf \
# remove the unnecessary .deb file
&& rm -f /tmp/appserver-runtime.deb \
# create a symlink for the appserver.io PHP binary
&& ln -s /opt/appserver/bin/php /usr/local/bin/php
################################################################################
# copy the appserver sources
ADD . /opt/appserver
################################################################################
# define working directory
WORKDIR /opt/appserver
################################################################################
# create a symlink for the appserver.io Composer binary
RUN ln -s /opt/appserver/bin/composer.phar /usr/local/bin/composer \
# install composer dependencies
&& composer install --prefer-dist --no-dev --no-interaction --optimize-autoloader \
# modify user-rights in configuration
&& sed -i "s/www-data/root/g" etc/appserver/appserver.xml \
# replace the default user/group for the PHP-FPM configuration
&& sed -i "s/user = www-data/user = root/g" etc/php-fpm.conf \
&& sed -i "s/group = www-data/group = root/g" etc/php-fpm.conf \
# modify system logger configuration
&& sed -i "s/var\/log\/appserver-errors.log/php:\/\/stderr/g" etc/appserver/appserver.xml \
# modify access logger configuration
&& sed -i "s/var\/log\/appserver-access.log/php:\/\/stdout/g" etc/appserver/appserver.xml \
# modify default HTTP server port configuration
&& sed -i "s/9080/80/g" etc/appserver/appserver.xml \
# modify default HTTPS server port configuration
&& sed -i "s/9443/443/g" etc/appserver/appserver.xml \
# modify the deployment scanners for usage with Supervisor
&& sed -i "s/DeploymentScanner/SupervisorDeploymentScanner/g" etc/appserver/appserver.xml \
# modify the error_log of PHP-FPM configuration to /dev/stderr
&& sed -i "s/;error_log = log\/php-fpm.log/error_log = \/proc\/self\/fd\/2/g" etc/php-fpm.conf \
# modify the error_log of PHP php.ini to /dev/stderr
&& sed -i "s/\/opt\/appserver\/var\/log\/php_errors.log/\/proc\/self\/fd\/2/g" etc/php.ini \
# modify the error_log of PHP-FPM php.ini to /dev/stderr
&& sed -i "s/\/opt\/appserver\/var\/log\/php-fpm-fcgi_errors.log/\/proc\/self\/fd\/2/g" etc/php-fpm-fcgi.ini \
&& sed -i "s/;always_populate_raw_post_data = On/always_populate_raw_post_data = -1/g" etc/php-fpm-fcgi.ini \
# create a symlink to the supervisord configuration file
&& ln -s /opt/appserver/etc/supervisor/conf.d/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
################################################################################
# expose ports
EXPOSE 80 443
# supervisord needs this
CMD []
# define default command
ENTRYPOINT ["/usr/bin/supervisord"]