-
Notifications
You must be signed in to change notification settings - Fork 77
/
Copy pathDockerfile
144 lines (122 loc) · 6.21 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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
FROM ubuntu:14.04
MAINTAINER Derek Bourgeois <derek@ibourgeois.com>
# set some environment variables
ENV APP_NAME app
ENV APP_EMAIL app@laraedit.com
ENV APP_DOMAIN app.dev
ENV DB_NAME app
ENV DB_PASS secret
ENV DEBIAN_FRONTEND noninteractive
# upgrade the container
RUN apt-get update && \
apt-get upgrade -y
# install some pre-requisites
RUN apt-get install -y software-properties-common curl build-essential \
dos2unix gcc git libmcrypt4 libpcre3-dev memcached make python2.7-dev \
python-pip re2c unattended-upgrades whois vim libnotify-bin nano wget \
debconf-utils
# add some repositories
RUN apt-add-repository ppa:nginx/stable -y && \
apt-add-repository ppa:rwky/redis -y && \
apt-add-repository ppa:ondrej/php -y && \
apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys 5072E1F5 && \
sh -c 'echo "deb http://repo.mysql.com/apt/ubuntu/ trusty mysql-5.7" >> /etc/apt/sources.list.d/mysql.list' && \
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - && \
sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main" >> /etc/apt/sources.list.d/postgresql.list' && \
curl -s https://packagecloud.io/gpg.key | apt-key add - && \
echo "deb http://packages.blackfire.io/debian any main" | tee /etc/apt/sources.list.d/blackfire.list && \
curl --silent --location https://deb.nodesource.com/setup_5.x | bash - && \
apt-get update
# set the locale
RUN echo "LC_ALL=en_US.UTF-8" >> /etc/default/locale && \
locale-gen en_US.UTF-8 && \
ln -sf /usr/share/zoneinfo/UTC /etc/localtime
# install nginx
RUN apt-get install -y --force-yes nginx
COPY homestead /etc/nginx/sites-available/
RUN rm -rf /etc/nginx/sites-available/default && \
rm -rf /etc/nginx/sites-enabled/default && \
ln -fs "/etc/nginx/sites-available/homestead" "/etc/nginx/sites-enabled/homestead" && \
sed -i -e"s/keepalive_timeout\s*65/keepalive_timeout 2/" /etc/nginx/nginx.conf && \
sed -i -e"s/keepalive_timeout 2/keepalive_timeout 2;\n\tclient_max_body_size 100m/" /etc/nginx/nginx.conf && \
echo "daemon off;" >> /etc/nginx/nginx.conf && \
usermod -u 1000 www-data && \
chown -Rf www-data.www-data /var/www/html/ && \
sed -i -e"s/worker_processes 1/worker_processes 5/" /etc/nginx/nginx.conf
VOLUME ["/var/www/html/app"]
VOLUME ["/var/cache/nginx"]
VOLUME ["/var/log/nginx"]
EXPOSE 80 443
# install php
RUN apt-get install -y --force-yes php7.0-cli php7.0-fpm php7.0-dev php7.0-pgsql \
php7.0-sqlite3 php7.0-gd php7.0-curl php7.0-imap php7.0-mysql php7.0-common \
php7.0-readline php7.0-json php7.0-opcache php-apcu php-memcached php-xdebug \
php-common php-igbinary php-msgpack
RUN sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php/7.0/cli/php.ini && \
sed -i "s/display_errors = .*/display_errors = On/" /etc/php/7.0/cli/php.ini && \
sed -i "s/;date.timezone.*/date.timezone = UTC/" /etc/php/7.0/cli/php.ini && \
sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php/7.0/fpm/php.ini && \
sed -i "s/display_errors = .*/display_errors = On/" /etc/php/7.0/fpm/php.ini && \
sed -i "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/" /etc/php/7.0/fpm/php.ini && \
sed -i "s/upload_max_filesize = .*/upload_max_filesize = 100M/" /etc/php/7.0/fpm/php.ini && \
sed -i "s/post_max_size = .*/post_max_size = 100M/" /etc/php/7.0/fpm/php.ini && \
sed -i "s/;date.timezone.*/date.timezone = UTC/" /etc/php/7.0/fpm/php.ini && \
sed -i -e "s/;daemonize\s*=\s*yes/daemonize = no/g" /etc/php/7.0/fpm/php-fpm.conf && \
sed -i -e "s/;catch_workers_output\s*=\s*yes/catch_workers_output = yes/g" /etc/php/7.0/fpm/pool.d/www.conf && \
sed -i -e "s/pm.max_children = 5/pm.max_children = 9/g" /etc/php/7.0/fpm/pool.d/www.conf && \
sed -i -e "s/pm.start_servers = 2/pm.start_servers = 3/g" /etc/php/7.0/fpm/pool.d/www.conf && \
sed -i -e "s/pm.min_spare_servers = 1/pm.min_spare_servers = 2/g" /etc/php/7.0/fpm/pool.d/www.conf && \
sed -i -e "s/pm.max_spare_servers = 3/pm.max_spare_servers = 4/g" /etc/php/7.0/fpm/pool.d/www.conf && \
sed -i -e "s/pm.max_requests = 500/pm.max_requests = 200/g" /etc/php/7.0/fpm/pool.d/www.conf && \
sed -i -e "s/;listen.mode = 0660/listen.mode = 0750/g" /etc/php/7.0/fpm/pool.d/www.conf && \
find /etc/php/7.0/cli/conf.d/ -name "*.ini" -exec sed -i -re 's/^(\s*)#(.*)/\1;\2/g' {} \;
COPY fastcgi_params /etc/nginx/
RUN phpenmod mcrypt && \
mkdir -p /run/php/ && chown -Rf www-data.www-data /run/php
# install sqlite
RUN apt-get install -y sqlite3 libsqlite3-dev
# install mysql
RUN echo mysql-server mysql-server/root_password password $DB_PASS | debconf-set-selections;\
echo mysql-server mysql-server/root_password_again password $DB_PASS | debconf-set-selections;\
apt-get install -y mysql-server && \
echo "default_password_lifetime = 0" >> /etc/mysql/my.cnf && \
sed -i '/^bind-address/s/bind-address.*=.*/bind-address = 0.0.0.0/' /etc/mysql/my.cnf # && \
# echo "CREATE DATABASE $DB_NAME;" | mysql -uroot -p$DB_PASS
EXPOSE 3306
VOLUME ["/var/lib/mysql"]
# install composer
RUN curl -sS https://getcomposer.org/installer | php && \
mv composer.phar /usr/local/bin/composer && \
printf "\nPATH=\"~/.composer/vendor/bin:\$PATH\"\n" | tee -a ~/.bashrc
# install laravel envoy
RUN composer global require "laravel/envoy"
#install laravel installer
RUN composer global require "laravel/installer"
# install nodejs
RUN apt-get install -y nodejs
# install gulp
RUN /usr/bin/npm install -g gulp
# install bower
RUN /usr/bin/npm install -g bower
# install redis
RUN apt-get install -y redis-server
EXPOSE 6379
# install blackfire
RUN apt-get install -y blackfire-agent blackfire-php
# install supervisor
RUN apt-get install -y supervisor && \
mkdir -p /var/log/supervisor
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
VOLUME ["/var/log/supervisor"]
# clean up our mess
RUN apt-get remove --purge -y software-properties-common && \
apt-get autoremove -y && \
apt-get clean && \
apt-get autoclean && \
echo -n > /var/lib/apt/extended_states && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /usr/share/man/?? && \
rm -rf /usr/share/man/??_*
# set container entrypoints
ENTRYPOINT ["/bin/bash","-c"]
CMD ["/usr/bin/supervisord"]