Initial commit
This commit is contained in:
commit
dd03aa6116
4
README.md
Normal file
4
README.md
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# DAMPPS: Docker Apache Mysql Postgresql Php Symfony
|
||||||
|
|
||||||
|
This docker image runs an Apache server configured with PHP and a database server
|
||||||
|
upon choice between MariaDB, MySQL or PostgreSQL.
|
3
app/index.php
Normal file
3
app/index.php
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
<?php
|
||||||
|
phpinfo()
|
||||||
|
?>
|
44
docker/.env
Normal file
44
docker/.env
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
#
|
||||||
|
# Docker
|
||||||
|
#
|
||||||
|
COMPOSE_PROJECT_NAME=project-1
|
||||||
|
APP_NAME=my_app
|
||||||
|
APP_FOLDER="../app"
|
||||||
|
|
||||||
|
#
|
||||||
|
# APACHE
|
||||||
|
#
|
||||||
|
HTTPD_SERVER_NAME=_
|
||||||
|
HTTPD_LISTEN_PORT=80
|
||||||
|
|
||||||
|
#
|
||||||
|
# Adminer
|
||||||
|
#
|
||||||
|
ADMINER_PORT=81
|
||||||
|
|
||||||
|
#
|
||||||
|
# MariaDB
|
||||||
|
#
|
||||||
|
MARIADB_PORT=3306
|
||||||
|
MARIADB_ROOT_PASSWORD=secret
|
||||||
|
MARIADB_USER=symfony
|
||||||
|
MARIADB_USER_PASSWORD=symfony
|
||||||
|
MARIADB_DATABASE=symfony
|
||||||
|
|
||||||
|
#
|
||||||
|
# MariaDB
|
||||||
|
#
|
||||||
|
MYSQLDB_PORT=3306
|
||||||
|
MYSQLDB_ROOT_PASSWORD=secret
|
||||||
|
MYSQLDB_USER=symfony
|
||||||
|
MYSQLDB_USER_PASSWORD=symfony
|
||||||
|
MYSQLDB_DATABASE=symfony
|
||||||
|
|
||||||
|
#
|
||||||
|
# PostgreSQL
|
||||||
|
#
|
||||||
|
POSTGRES_PORT=5432
|
||||||
|
POSTGRES_PASSWORD=secret
|
||||||
|
POSTGRES_USER=symfony
|
||||||
|
POSTGRES_DATABASE=symfony
|
||||||
|
POSTGRES_INITDB_ARGS=--auth-host=scram-sha-256
|
141
docker/docker-compose.yml
Normal file
141
docker/docker-compose.yml
Normal file
@ -0,0 +1,141 @@
|
|||||||
|
---
|
||||||
|
version: '3.8'
|
||||||
|
|
||||||
|
networks:
|
||||||
|
mynetwork:
|
||||||
|
name: "${APP_NAME}-net"
|
||||||
|
|
||||||
|
services:
|
||||||
|
# apache:
|
||||||
|
# container_name: "${APP_NAME}-apache"
|
||||||
|
# labels:
|
||||||
|
# local.project: "${APP_NAME}"
|
||||||
|
# build:
|
||||||
|
# context: .
|
||||||
|
# dockerfile: apache/Dockerfile
|
||||||
|
# restart: always
|
||||||
|
# ports:
|
||||||
|
# - "${HTTPD_LISTEN_PORT}:80"
|
||||||
|
# volumes:
|
||||||
|
# - "${APP_FOLDER}:/usr/local/apache2/htdocs"
|
||||||
|
# - ./apache/vhosts:/etc/apache2/sites-enabled
|
||||||
|
# - ./tmp:/tmp
|
||||||
|
# - ./apache/logs:/var/log/httpd:cached
|
||||||
|
# depends_on:
|
||||||
|
# - php
|
||||||
|
# networks:
|
||||||
|
# - mynetwork
|
||||||
|
|
||||||
|
php:
|
||||||
|
container_name: "${APP_NAME}-php"
|
||||||
|
labels:
|
||||||
|
local.project: "${APP_NAME}"
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: php/Dockerfile
|
||||||
|
restart: always
|
||||||
|
ports:
|
||||||
|
- "${HTTPD_LISTEN_PORT}:80"
|
||||||
|
volumes:
|
||||||
|
- "${APP_FOLDER}:/var/www/html"
|
||||||
|
- ./apache/vhosts:/etc/apache2/sites-enabled
|
||||||
|
- ./apache/logs:/var/log/apache2:cached
|
||||||
|
- ./tmp:/tmp
|
||||||
|
networks:
|
||||||
|
- mynetwork
|
||||||
|
|
||||||
|
mariadb:
|
||||||
|
container_name: "${APP_NAME}-mariadb"
|
||||||
|
labels:
|
||||||
|
local.project: "${APP_NAME}"
|
||||||
|
image: mariadb
|
||||||
|
restart: always
|
||||||
|
ports:
|
||||||
|
- "${MARIADB_PORT}:3306"
|
||||||
|
volumes:
|
||||||
|
- db_data:/var/lib/mysql
|
||||||
|
- ./mariadb:/etc/mysql
|
||||||
|
environment:
|
||||||
|
MARIADB_ROOT_PASSWORD: "${MARIADB_ROOT_PASSWORD}"
|
||||||
|
MARIADB_USER: "${MARIADB_USER}"
|
||||||
|
MARIADB_PASSWORD: "${MARIADB_USER_PASSWORD}"
|
||||||
|
MARIADB_DATABASE: "${MARIADB_DATABASE}"
|
||||||
|
healthcheck:
|
||||||
|
test: mysqladmin ping -h 127.0.0.1 -u root --password=$${MARIADB_ROOT_PASSWORD}
|
||||||
|
interval: 5s
|
||||||
|
retries: 5
|
||||||
|
networks:
|
||||||
|
- mynetwork
|
||||||
|
profiles:
|
||||||
|
- mariadb
|
||||||
|
|
||||||
|
mysql:
|
||||||
|
container_name: "${APP_NAME}-mysql"
|
||||||
|
labels:
|
||||||
|
local.project: "${APP_NAME}"
|
||||||
|
image: mysql
|
||||||
|
restart: always
|
||||||
|
ports:
|
||||||
|
- "${MYSQLDB_PORT}:3306"
|
||||||
|
volumes:
|
||||||
|
- db_data:/var/lib/mysql
|
||||||
|
- ./mysql:/etc/mysql
|
||||||
|
environment:
|
||||||
|
MYSQL_ROOT_PASSWORD: "${MYSQLDB_ROOT_PASSWORD}"
|
||||||
|
MYSQL_USER: "${MYSQLDB_USER}"
|
||||||
|
MYSQL_PASSWORD: "${MYSQLDB_USER_PASSWORD}"
|
||||||
|
MYSQL_DATABASE: "${MYSQLDB_DATABASE}"
|
||||||
|
healthcheck:
|
||||||
|
test: mysqladmin ping -h 127.0.0.1 -u root --password=$${MYSQLDB_ROOT_PASSWORD}
|
||||||
|
interval: 5s
|
||||||
|
retries: 5
|
||||||
|
networks:
|
||||||
|
- mynetwork
|
||||||
|
profiles:
|
||||||
|
- mysql
|
||||||
|
|
||||||
|
pgsql:
|
||||||
|
container_name: "${APP_NAME}-pgsql"
|
||||||
|
labels:
|
||||||
|
local.project: "${APP_NAME}"
|
||||||
|
image: postgres
|
||||||
|
restart: always
|
||||||
|
ports:
|
||||||
|
- "${POSTGRES_PORT}:5432"
|
||||||
|
volumes:
|
||||||
|
- db_data:/var/lib/postgresql/data
|
||||||
|
- ./postgresql:/etc/postgresql
|
||||||
|
environment:
|
||||||
|
POSTGRES_PASSWORD: "${POSTGRES_PASSWORD}"
|
||||||
|
POSTGRES_USER: "${POSTGRES_USER}"
|
||||||
|
POSTGRES_DB: "${POSTGRES_DATABASE}"
|
||||||
|
POSTGRES_INITDB_ARGS: --auth-host=scram-sha-256
|
||||||
|
healthcheck:
|
||||||
|
test: pg_isready -h 127.0.0.1 -u $${POSTGRES_USER}
|
||||||
|
interval: 5s
|
||||||
|
retries: 5
|
||||||
|
networks:
|
||||||
|
- mynetwork
|
||||||
|
profiles:
|
||||||
|
- pgsql
|
||||||
|
|
||||||
|
adminer:
|
||||||
|
container_name: "${APP_NAME}-adminer"
|
||||||
|
labels:
|
||||||
|
local.project: "${APP_NAME}"
|
||||||
|
image: adminer
|
||||||
|
restart: always
|
||||||
|
environment:
|
||||||
|
ADMINER_DESIGN: 'dracula'
|
||||||
|
ADMINER_PLUGINS: 'tables-filter tinymce'
|
||||||
|
ports:
|
||||||
|
- "${ADMINER_PORT}:8080"
|
||||||
|
depends_on:
|
||||||
|
# - apache
|
||||||
|
- php
|
||||||
|
networks:
|
||||||
|
- mynetwork
|
||||||
|
profiles: ['mariadb', 'mysql', 'pgsql']
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
db_data:
|
21
docker/php/Dockerfile
Normal file
21
docker/php/Dockerfile
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# syntax=docker/dockerfile:1
|
||||||
|
FROM php:8.1-apache
|
||||||
|
|
||||||
|
# make some stuff
|
||||||
|
RUN apt-get update
|
||||||
|
RUN apt-get install -y --no-install-recommends nano
|
||||||
|
|
||||||
|
# we get a tool used to easily install a PHP extension
|
||||||
|
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
|
||||||
|
|
||||||
|
# and run it
|
||||||
|
RUN chmod +x /usr/local/bin/install-php-extensions && \
|
||||||
|
install-php-extensions amqp gd exif intl mbstring opcache pdo_mysql pdo_pgsql redis xdebug xsl zip && \
|
||||||
|
install-php-extensions @composer
|
||||||
|
|
||||||
|
# add symfony-cli repo
|
||||||
|
RUN curl -1sLf 'https://dl.cloudsmith.io/public/symfony/stable/setup.deb.sh' | bash
|
||||||
|
|
||||||
|
# and install it
|
||||||
|
RUN apt-get install -y --no-install-recommends symfony-cli
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user