Skip to content

Commit a9d605a

Browse files
committed
Initial commit
0 parents  commit a9d605a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+1986
-0
lines changed

.docker/.env.dist

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
PROJECT_NAME=symfony-project-template
2+
3+
HTTP_PORT=80
4+
5+
PHP_VERSION=7.4
6+
COMPOSER_INSTALL=1
7+
8+
ENABLE_XDEBUG=0
9+
10+
MYSQL_VERSION=8
11+
MYSQL_HOST=mysql
12+
MYSQL_DATABASE=example
13+
MYSQL_ROOT_PASSWORD=1
14+
MYSQL_USER=dev
15+
MYSQL_PASSWORD=dev
16+
MYSQL_PORT=3306
17+
18+
DATABASE_URL=mysql://dev:dev@mysql:3306/example

.docker/.env.testing

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ENABLE_XDEBUG=1
2+
APP_ENV=test

.docker/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
data
2+
docker-compose.override.yml

.docker/Makefile

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
-include .env
2+
3+
help:
4+
@echo ""
5+
@echo "usage: make COMMAND"
6+
@echo ""
7+
@echo "Commands:"
8+
@echo " setup Setup default setting for simple run"
9+
@echo " up Run all containers in detached mode"
10+
@echo " stop Stop all containers"
11+
@echo " restart Restart all containers"
12+
@echo " rm Stop and remove all containers"
13+
@echo " logs Follow logs"
14+
@echo " tests Run tests"
15+
@echo " coverage Run code coverage"
16+
17+
up: setup build
18+
@docker-compose up -d
19+
20+
build: setup
21+
@docker-compose build
22+
23+
stop:
24+
@docker-compose stop
25+
26+
restart:
27+
@docker-compose restart
28+
29+
rm:
30+
@docker-compose rm --stop --force
31+
32+
logs:
33+
@docker-compose logs -f -t --tail=1000
34+
35+
setup:
36+
@cp -n .env.dist .env
37+
@cp -n docker-compose.override.yml.dist docker-compose.override.yml
38+
39+
tests: setup
40+
@docker-compose -p ${PROJECT_NAME}_testing -f docker-compose.yml -f docker-compose.testing.yml up -d
41+
@docker-compose -p ${PROJECT_NAME}_testing exec -T web bash /wait-for.sh --timeout=30 localhost:80 -- echo "Webserver started"
42+
@docker-compose -p ${PROJECT_NAME}_testing exec -T php ./vendor/bin/codecept run
43+
@docker-compose -p ${PROJECT_NAME}_testing stop
44+
45+
coverage: setup
46+
@docker-compose -p ${PROJECT_NAME}_testing -f docker-compose.yml -f docker-compose.testing.yml up -d
47+
@docker-compose -p ${PROJECT_NAME}_testing exec -T web bash /wait-for.sh --timeout=30 localhost:80 -- echo "Webserver started"
48+
@docker-compose -p ${PROJECT_NAME}_testing exec -T php ./vendor/bin/codecept run --coverage --coverage-xml
49+
@docker-compose -p ${PROJECT_NAME}_testing stop
50+
51+
ci: setup
52+
@docker-compose -p ${PROJECT_NAME}_testing -f docker-compose.yml -f docker-compose.testing.yml up -d
53+
@docker-compose -p ${PROJECT_NAME}_testing exec -T web bash /wait-for.sh --timeout=30 localhost:80 -- echo "Webserver started"
54+
@docker-compose -p ${PROJECT_NAME}_testing exec -T php ./vendor/bin/codecept run --coverage --coverage-xml
55+
@docker-compose -p ${PROJECT_NAME}_testing exec -T php ./vendor/bin/grumphp run --testsuite=ci
56+
@docker-compose -p ${PROJECT_NAME}_testing stop
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
version: "3"
2+
services:
3+
web:
4+
ports:
5+
- ${HTTP_PORT}:80
6+
mysql:
7+
ports:
8+
- ${MYSQL_PORT}:3306

.docker/docker-compose.testing.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: "3"
2+
services:
3+
web:
4+
container_name: ${PROJECT_NAME}_web_testing
5+
env_file:
6+
- ".env.testing"
7+
php:
8+
container_name: ${PROJECT_NAME}_php_testing
9+
env_file:
10+
- ".env.testing"

.docker/docker-compose.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
version: "3"
2+
services:
3+
php:
4+
container_name: ${PROJECT_NAME}_php
5+
image: ${PROJECT_NAME}_php
6+
restart: on-failure
7+
build:
8+
context: ./php
9+
args:
10+
PHP_VERSION: ${PHP_VERSION}
11+
tty: true
12+
env_file:
13+
- ./.env
14+
volumes:
15+
- ./php/xdebug.ini:/usr/local/etc/php/conf.d/xdebug.ini
16+
- ..:/var/www/html
17+
depends_on:
18+
- mysql
19+
web:
20+
container_name: ${PROJECT_NAME}_web
21+
build: nginx
22+
volumes:
23+
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf
24+
- ..:/var/www/html
25+
depends_on:
26+
- php
27+
restart: on-failure
28+
env_file:
29+
- ./.env
30+
mysql:
31+
container_name: ${PROJECT_NAME}_mysql
32+
image: mysql:${MYSQL_VERSION}
33+
restart: on-failure
34+
env_file:
35+
- ".env"
36+
environment:
37+
- MYSQL_DATABASE=${MYSQL_DATABASE}
38+
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
39+
- MYSQL_USER=${MYSQL_USER}
40+
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
41+
volumes:
42+
- "./data/mysql:/var/lib/mysql"

.docker/nginx/Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM nginx:alpine
2+
3+
RUN apk add --update bash curl
4+
5+
ADD start.sh /start.sh
6+
RUN chmod 755 /start.sh
7+
CMD ["/start.sh"]
8+
9+
ADD wait-for.sh /wait-for.sh
10+
RUN chmod 755 /wait-for.sh

.docker/nginx/default.conf

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
server {
2+
listen 80;
3+
server_name localhost;
4+
5+
root /var/www/html/public;
6+
7+
index index.php;
8+
9+
error_log /dev/stdout info;
10+
access_log /dev/stdout;
11+
12+
location / {
13+
try_files $uri $uri/ /index.php?$query_string;
14+
}
15+
16+
location ~ \.php$ {
17+
fastcgi_pass php:9000;
18+
fastcgi_index index.php;
19+
include fastcgi_params;
20+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
21+
fastcgi_param PATH_INFO $fastcgi_path_info;
22+
}
23+
}

.docker/nginx/start.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
echo 'Run start.sh'
3+
4+
bash /wait-for.sh php:9000 --timeout=30 -- echo "Php fpm started"
5+
6+
nginx -g 'daemon off;'

0 commit comments

Comments
 (0)