Skip to content
This repository has been archived by the owner on Mar 11, 2018. It is now read-only.

Add Dockerfile to setup wordpress-heroku in local environment #129

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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 [email protected]

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
5 changes: 5 additions & 0 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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
9 changes: 9 additions & 0 deletions docker/pg_hba.conf
Original file line number Diff line number Diff line change
@@ -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