diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000..ac4650d240 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,41 @@ +########################################################## +# # +# 1. Build the image: # +# docker build -t wordpress-heroku . # +# # +# 2. Run the container: # +# docker run -ti --rm -v $(pwd):/var/www/html \ # +# -p 80:80 wordpress-heroku # +# # +# 3. Visit localhost:80 in browser # +# # +########################################################## + + +FROM debian:latest +MAINTAINER Berin larson004@gmail.com + +RUN apt-get update && apt-get -y install apache2 libapache2-mod-php5 +RUN apt-get -y install postgresql php5-pgsql +RUN a2enmod php5 + +ENV APACHE_RUN_USER postgres +ENV APACHE_RUN_GROUP postgres +ENV APACHE_LOG_DIR /var/log/apache2 +ENV APACHE_PID_FILE /var/run/apache2.pid +ENV APACHE_RUN_DIR /var/run/apache2 +ENV APACHE_LOCK_DIR /var/lock/apache2 + +EXPOSE 80 +EXPOSE 5432 + +RUN echo "listen_addresses='*'" >> /etc/postgresql/9.4/main/postgresql.conf +RUN echo "ServerName localhost" >> /etc/apache2/apache2.conf + +COPY docker/pg_hba.conf /etc/postgresql/9.4/main/pg_hba.conf + +# Copying entrypoint script and setting proper permission. +COPY docker/entrypoint.sh / +RUN chmod +x /entrypoint.sh + +ENTRYPOINT /entrypoint.sh diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh new file mode 100755 index 0000000000..d64a45ff3d --- /dev/null +++ b/docker/entrypoint.sh @@ -0,0 +1,5 @@ +service postgresql start +psql -U postgres -c "CREATE DATABASE wordpress;" +psql -U postgres -c "CREATE USER wordpress WITH PASSWORD 'wordpress'; GRANT ALL PRIVILEGES ON DATABASE wordpress to wordpress;" +usr/sbin/apache2 -D FOREGROUND +tail diff --git a/docker/pg_hba.conf b/docker/pg_hba.conf new file mode 100644 index 0000000000..b415883a38 --- /dev/null +++ b/docker/pg_hba.conf @@ -0,0 +1,9 @@ +# local +local all postgres trust + +# IPv4 local connections: +host all all 127.0.0.1/32 trust +host all all 10.0.0.0/8 md5 +host all all 192.0.0.0/8 md5 +# IPv6 local connections: +host all all ::1/128 md5