Skip to content

Commit 7384d4c

Browse files
committed
Updated Dockerfile
1 parent b3d24cf commit 7384d4c

File tree

9 files changed

+105
-268
lines changed

9 files changed

+105
-268
lines changed

Dockerfile

Lines changed: 42 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,48 @@
1-
FROM ubuntu:14.04
2-
MAINTAINER Sukru Uzel <uzelsukru@gmail.com>
3-
4-
# Keep upstart
5-
RUN dpkg-divert --local --rename --add /sbin/initctl && ln -sf /bin/true /sbin/initctl
6-
7-
# Set no tty
8-
ENV DEBIAN_FRONTEND noninteractive
9-
ENV MYSQL_DB pw_db
10-
ENV MYSQL_USER pw_user
11-
ENV MYSQL_PASS pw_pass
12-
13-
# Update System
14-
RUN apt-get update && apt-get -y upgrade
15-
16-
# Basic Requirements
17-
RUN apt-get install -y pwgen --force-yes python-setuptools curl git unzip \
18-
mysql-server mysql-client \
19-
nginx \
20-
php5-fpm php5-mysql php-apc php5-cli php5-curl php5-gd php5-mcrypt php5-intl \
21-
php5-imap php5-tidy php5-imagick php5-memcache php5-xmlrpc php5-xsl
22-
23-
# MySQL Config
24-
RUN sed -i -e"s/^bind-address\s*=\s*127.0.0.1/bind-address = 0.0.0.0/" /etc/mysql/my.cnf
25-
26-
# Nginx Config
27-
RUN sed -i -e"s/keepalive_timeout\s*65/keepalive_timeout 2/" /etc/nginx/nginx.conf && \
28-
sed -i -e"s/keepalive_timeout 2/keepalive_timeout 2;\n\tclient_max_body_size 100m/" /etc/nginx/nginx.conf && \
29-
echo "daemon off;" >> /etc/nginx/nginx.conf
30-
ADD ./config/nginx-site.conf /etc/nginx/sites-available/default
31-
32-
# PHP Config
33-
RUN sed -i -e "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g" /etc/php5/fpm/php.ini && \
34-
sed -i -e "s/upload_max_filesize\s*=\s*2M/upload_max_filesize = 100M/g" /etc/php5/fpm/php.ini && \
35-
sed -i -e "s/post_max_size\s*=\s*8M/post_max_size = 100M/g" /etc/php5/fpm/php.ini && \
36-
sed -i -e "s/;daemonize\s*=\s*yes/daemonize = no/g" /etc/php5/fpm/php-fpm.conf && \
37-
sed -i -e "s/;catch_workers_output\s*=\s*yes/catch_workers_output = yes/g" /etc/php5/fpm/pool.d/www.conf && \
38-
find /etc/php5/cli/conf.d/ -name "*.ini" -exec sed -i -re 's/^(\s*)#(.*)/\1;\2/g' {} \;
39-
40-
# ProcessWire Install
41-
RUN git clone git://github.com/ryancramerdesign/ProcessWire.git -b master && cd ProcessWire/ && rm -rf .git
42-
43-
# Supervisor Config
44-
RUN easy_install supervisor
45-
ADD ./config/supervisord.conf /etc/supervisord.conf
46-
47-
# Volume
48-
VOLUME ["/var/lib/mysql", "/usr/share/nginx"]
1+
FROM ubuntu:16.04
2+
MAINTAINER Sukru Uzel <sukru.uzel@gmail.com>
3+
4+
# Packages installation
5+
RUN apt-get update && \
6+
apt-get dist-upgrade -y && \
7+
apt-get install -y \
8+
git \
9+
apache2 \
10+
libapache2-mod-php7.0 \
11+
php7.0 \
12+
php7.0-cli \
13+
php7.0-gd \
14+
php7.0-json \
15+
php7.0-ldap \
16+
php7.0-mbstring \
17+
php7.0-mysql \
18+
php7.0-xml \
19+
php7.0-xsl \
20+
php7.0-zip \
21+
php7.0-soap
22+
23+
# Update the default apache site with the config we created.
24+
COPY config/apache/default.conf /etc/apache2/sites-available/000-default.conf
25+
RUN a2enmod rewrite
26+
27+
# Update php.ini
28+
RUN sed -ri 's/^display_errors\s*=\s*Off/display_errors = On/g' /etc/php/7.0/apache2/php.ini
29+
RUN sed -ri 's/^display_errors\s*=\s*Off/display_errors = On/g' /etc/php/7.0/cli/php.ini
30+
31+
# Install ProcessWire
32+
RUN git clone git://github.com/ryancramerdesign/ProcessWire.git -b master /var/www/pw
33+
RUN chown -R www-data:www-data /var/www/pw
4934

5035
# Expose
5136
EXPOSE 80
52-
EXPOSE 3306
5337

54-
# Startup Script
55-
ADD ./scripts/start.sh /scripts/start.sh
56-
RUN chmod 755 /scripts/start.sh
57-
CMD ["/bin/bash", "/scripts/start.sh"]
38+
# Volume
39+
VOLUME ["/var/www/pw"]
5840

5941
# Clean
60-
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
42+
RUN apt-get clean && \
43+
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /var/www/pw/.git
44+
45+
# Init
46+
ADD scripts/init.sh /init.sh
47+
RUN chmod +x /init.sh
48+
CMD ["/init.sh"]

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2017 Şükrü Uzel
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

100755100644
Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# ProcessWire Docker Image
2-
32
[![Go to Docker Hub](https://img.shields.io/badge/Docker%20Hub-%E2%86%92-blue.svg)](https://hub.docker.com/r/suzel/docker-processwire/)
43

54
A Docker container for Processwire Projects.
@@ -25,20 +24,16 @@ $ docker build -t suzel/docker-processwire .
2524
Start your image binding external port 80 in all interfaces to your container:
2625

2726
```sh
28-
$ docker run --name webproject \
29-
-v $PWD:/usr/share/nginx \
27+
$ docker run --name pw-project \
28+
-v $PWD:/var/www/pw \
3029
-p 80:80 \
31-
-p 3306:3306 \
32-
-e MYSQL_DB=pw_db \
33-
-e MYSQL_USER=pw_user \
34-
-e MYSQL_PASS=pw_pass \
3530
-d suzel/docker-processwire
3631
```
3732

3833
You can the visit the following URL in a browser on your host machine to get started:
3934

4035
```
41-
open http://<docker ip address>
36+
$ open http://<docker_ip_address>
4237
```
4338

4439
## Documentation

config/apache/default.conf

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<VirtualHost *:80>
2+
# The ServerName directive sets the request scheme, hostname and port that
3+
# the server uses to identify itself. This is used when creating
4+
# redirection URLs. In the context of virtual hosts, the ServerName
5+
# specifies what hostname must appear in the request's Host: header to
6+
# match this virtual host. For the default virtual host (this file) this
7+
# value is not decisive as it is used as a last resort host regardless.
8+
# However, you must set it for any further virtual host explicitly.
9+
#ServerName www.example.com
10+
11+
ServerAdmin webmaster@localhost
12+
DocumentRoot /var/www/pw
13+
14+
<Directory /var/www/pw>
15+
Options Indexes FollowSymLinks MultiViews
16+
AllowOverride All
17+
Require all granted
18+
</Directory>
19+
20+
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
21+
# error, crit, alert, emerg.
22+
# It is also possible to configure the loglevel for particular
23+
# modules, e.g.
24+
#LogLevel info ssl:warn
25+
26+
ErrorLog /dev/stdout
27+
CustomLog /dev/stdout combined
28+
29+
# For most configuration files from conf-available/, which are
30+
# enabled or disabled at a global level, it is possible to
31+
# include a line for only one particular virtual host. For example the
32+
# following line enables the CGI configuration for this host only
33+
# after it has been globally disabled with "a2disconf".
34+
#Include conf-available/serve-cgi-bin.conf
35+
</VirtualHost>

config/nginx-site.conf

Lines changed: 0 additions & 144 deletions
This file was deleted.

config/supervisord.conf

Lines changed: 0 additions & 24 deletions
This file was deleted.

docker-build.sh

Lines changed: 0 additions & 3 deletions
This file was deleted.

scripts/init.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
3+
source /etc/apache2/envvars
4+
exec apache2 -D FOREGROUND

0 commit comments

Comments
 (0)