Skip to content

Instantly share code, notes, and snippets.

@arcanisgk
Created July 18, 2023 16:44
Show Gist options
  • Save arcanisgk/f2b40ff6e119303cf86dde0b43be01d0 to your computer and use it in GitHub Desktop.
Save arcanisgk/f2b40ff6e119303cf86dde0b43be01d0 to your computer and use it in GitHub Desktop.
DNS+Revese Proxy+LAMP Stack
version: "3.9"
services:
dnsmasq:
env_file:
- .env
container_name: ${SYSTEM_NAME}-DNS-Server
image: jpillora/dnsmasq
ports:
- "53:53/udp"
- "5380:8080"
volumes:
- ${DNS_CONF-./config/dnsmasq/dnsmasq.conf}:/etc/dnsmasq.conf
logging:
options:
max-size: "100m"
environment:
- HTTP_USER=${DNS_USER}
- HTTP_PASS=${DNS_PASS}
restart: always
networks:
lamp-network:
reverse-proxy:
env_file:
- .env
container_name: ${SYSTEM_NAME}-Proxy-Server
image: jwilder/nginx-proxy
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
ports:
- "${HOST_MACHINE_UNSECURE_HOST_PORT:-80}:80"
networks:
lamp-network:
extra_hosts:
- "${WEB_SERVER_DOMAIN}:127.0.0.1"
- "${PHPMYADMIN_DOMAIN}:127.0.0.1"
- "${CRON_DOMAIN}:127.0.0.1"
- "${INCRON_DOMAIN}:127.0.0.1"
webserver:
env_file:
- .env
container_name: ${SYSTEM_NAME}-Web-Server
build:
context: ./bin/${PHP_ENVIRONMENT}
restart: always
expose:
- 80
networks:
lamp-network:
depends_on:
- database
volumes:
- ${PROJECT_ROOT-./../../../}:/var/www/html:rw
- ${PROJECT_ROOT-./../../../}${DOCUMENT_ROOT-./public}:/var/www/html/public:rw
- ${VHOSTS_DIR-./config/vhosts}:/etc/apache2/sites-enabled
- ${PHP_INI-./config/php/php.ini}:/usr/local/etc/php/php.ini
- ${LOG_DIR-./logs/apache2}:/var/log/apache2
environment:
VIRTUAL_HOST: ${WEB_SERVER_DOMAIN}
WEB_MASTER: ${WEB_MASTER}
APACHE_DOCUMENT_ROOT: ${APACHE_DOCUMENT_ROOT}
HOST_MACHINE_MYSQL_PORT: ${HOST_MACHINE_MYSQL_PORT}
HOST_MACHINE_PMA_PORT: ${HOST_MACHINE_PMA_PORT}
MYSQL_DATABASE: ${MYSQL_DATABASE}
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_USER: ${MYSQL_USER}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
database:
env_file:
- .env
build:
context: ./bin/${DATABASE}
container_name: ${SYSTEM_NAME}-${DATABASE}
restart: always
networks:
lamp-network:
ports:
- "${HOST_MACHINE_MYSQL_PORT}:${HOST_MACHINE_MYSQL_PORT}"
volumes:
- ${MYSQL_INITDB_DIR-./config/initdb}:/docker-entrypoint-initdb.d
- ${MYSQL_DATA_DIR-./data/mysql}:/var/lib/mysql
- ${MYSQL_LOG_DIR-./logs/mysql}:/var/log/mysql
environment:
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
- MYSQL_DATABASE=${MYSQL_DATABASE}
- MYSQL_USER=${MYSQL_USER}
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
phpmyadmin:
env_file:
- .env
container_name: ${SYSTEM_NAME}-phpmyadmin
image: phpmyadmin
restart: always
depends_on:
- database
environment:
- VIRTUAL_HOST=${PHPMYADMIN_DOMAIN}
- PMA_HOST=${MYSQL_PMA_HOST}
- PMA_PORT=${HOST_MACHINE_MYSQL_PORT}
- PMA_USER=${MYSQL_PMA_USER}
- PMA_PASSWORD=${MYSQL_ROOT_PASSWORD}
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
- MYSQL_USER=${MYSQL_USER}
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
- UPLOAD_LIMIT=${UPLOAD_LIMIT}
- MEMORY_LIMIT=${MEMORY_LIMIT}
volumes:
- /sessions
- ${PHP_INI-./config/php/php.ini}:/usr/local/etc/php/conf.d/php-phpmyadmin.ini
networks:
lamp-network:
networks:
lamp-network:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment