Skip to content

Commit

Permalink
Source files
Browse files Browse the repository at this point in the history
  • Loading branch information
kido committed Dec 26, 2017
1 parent 7eb8d81 commit 9934b7a
Show file tree
Hide file tree
Showing 16 changed files with 871 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .env
@@ -0,0 +1,14 @@
#!/usr/bin/env bash

# See https://docs.docker.com/compose/environment-variables/#the-env-file

# Nginx
NGINX_HOST=localhost

# MySQL
MYSQL_HOST=mysql
MYSQL_DATABASE=test
MYSQL_ROOT_USER=root
MYSQL_ROOT_PASSWORD=root
MYSQL_USER=dev
MYSQL_PASSWORD=dev
34 changes: 34 additions & 0 deletions Dockerfile
@@ -0,0 +1,34 @@
FROM ubuntu:latest
MAINTAINER Dan Pupius <dan@pupi.us>

# Install apache, PHP, and supplimentary programs. openssh-server, curl, and lynx-cur are for debugging the container.
RUN apt-get update && apt-get -y upgrade && DEBIAN_FRONTEND=noninteractive apt-get -y install \
apache2 php7.0 php7.0-mysql libapache2-mod-php7.0 curl lynx-cur

# Enable apache mods.
RUN a2enmod php7.0
RUN a2enmod rewrite

# Update the PHP.ini file, enable <? ?> tags and quieten logging.
RUN sed -i "s/short_open_tag = Off/short_open_tag = On/" /etc/php/7.0/apache2/php.ini
RUN sed -i "s/error_reporting = .*$/error_reporting = E_ERROR | E_WARNING | E_PARSE/" /etc/php/7.0/apache2/php.ini

# Manually set up the apache environment variables
ENV APACHE_RUN_USER www-data
ENV APACHE_RUN_GROUP www-data
ENV APACHE_LOG_DIR /var/log/apache2
ENV APACHE_LOCK_DIR /var/lock/apache2
ENV APACHE_PID_FILE /var/run/apache2.pid

# Expose apache.
EXPOSE 80

# Copy this repo into place.
ADD web /var/www/site

# Update the default apache site with the config we created.
ADD etc/apache/sites-enabled/apache-config.conf /etc/apache2/sites-enabled/000-default.conf

# By default start up apache in the foreground, override with /bin/bash for interative.
CMD /usr/sbin/apache2ctl -D FOREGROUND

61 changes: 61 additions & 0 deletions docker-compose.yml
@@ -0,0 +1,61 @@
version: "2"
services:
reverseproxy:
image: nginx
container_name: nginx-docker
volumes:
- "./etc/nginx/conf.d:/etc/nginx/conf.d"
- "./etc/ssl:/etc/ssl"
- "./web:/var/www/html"
- "./etc/nginx/conf.d/default.template:/etc/nginx/conf.d/default.template"
- "./etc/nginx/nginx.conf:/etc/nginx/nginx.conf"
- "./etc/nginx/log/error.log:/var/log/nginx/error.log"
ports:
- "80:80"
- "443:443"
environment:
- NGINX_HOST=${NGINX_HOST}
command: /bin/bash -c "envsubst '$$NGINX_HOST' < /etc/nginx/conf.d/default.template > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'"
restart: always
depends_on:
- mysqldb
- web
web:
image: apachemy
container_name: apache-docker
volumes:
- "./web:/var/www/site"
- "./etc/apache/httpd.conf:/usr/local/apache2/conf/httpd.conf"
- "./etc/apache/sites-available:/etc/apache2/sites-available"
- "./etc/apache/sites-enabled:/etc/apache2/sites-enabled"
ports:
- "8099:80"
restart: always
depends_on:
- mysqldb
myadmin:
image: phpmyadmin/phpmyadmin
container_name: phpmyadmin
ports:
- "8080:80"
environment:
- PMA_ARBITRARY=1
- PMA_HOST=${MYSQL_HOST}
restart: always
depends_on:
- mysqldb
mysqldb:
image: mysql
container_name: ${MYSQL_HOST}
restart: always
env_file:
- ".env"
environment:
- MYSQL_DATABASE=${MYSQL_DATABASE}
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
- MYSQL_USER=${MYSQL_USER}
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
ports:
- "8989:3306"
volumes:
- "./data/db/mysql:/var/lib/mysql"

0 comments on commit 9934b7a

Please sign in to comment.