Skip to content

Commit 157b131

Browse files
Iniciado a reformulação da estrutura do repositório.
1 parent c34b0ab commit 157b131

12 files changed

+127
-24
lines changed

Diff for: .editorconfig

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
root = true
2+
3+
[*]
4+
end_of_line = lf
5+
insert_final_newline = true
6+
charset = utf-8
7+
indent_style = space
8+
9+
[*.php]
10+
indent_size = 4
11+
12+
[*.{js, json}]
13+
indent_size = 2
14+
15+
[Makefile]
16+
indent_style = tab

Diff for: .env-example

Whitespace-only changes.

Diff for: .gitignore

+6-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1-
mysql/*
1+
/docker/mysql/*
2+
/node_modules
3+
/vendor
4+
.phpunit.result.cache
5+
/.idea
6+
/.vscode

Diff for: .gitignote

-2
This file was deleted.

Diff for: README.md

+83-6
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,104 @@
1-
# skeleton-docker-php
1+
# Skeleton PHP application with Docker
22

3-
# work in progress
3+
## Obrigatório
44

5-
Repositório de estrutura para utilizar em projetos testes PHP
5+
- Docker;
6+
- Docker Compose.
67

8+
## Clonando o projeto
79

8-
# comandos
10+
Clone o projeto, versione apenas o diretório `app`.
911

12+
```bash
13+
git clone https://github.com/Diego-Brocanelli/php-docker.git NOME_DO_SEU_PROJETO
14+
```
1015

16+
## Instalação
17+
18+
Acesse a raiz do projeto, e execute o comando abaixo.
19+
20+
```bash
21+
docker-compose up
22+
```
23+
24+
Executar em segundo plano.
25+
26+
```bash
27+
docker-compose up -d
28+
```
29+
30+
## Estrutura base para o projeto
31+
32+
- docs.
33+
- Inclua toda a documentação do projeto aqui.
34+
- src.
35+
- Diretório responsável por conter todos os códigos do seu projeto.
36+
- tests.
37+
- Diretório responsável por conter todos os testes da sua aplicação.
38+
.env
39+
- Configurações do projeto.
40+
41+
## Acessando o container
42+
43+
```bash
44+
docker exec -it app bash
45+
```
46+
47+
Dentro do container terá acesso as tecnologias listadas abaixo.
48+
49+
- PHP 8.1;
50+
- PHPStan;
51+
- PHPCs;
52+
- Psalm;
53+
- PHPUnit;
54+
- PHPLoc
55+
- Composer;
56+
- Nodejs;
57+
- NPM.
58+
59+
## Executando comandos fora do container
60+
61+
Acessando o PHP.
62+
```bash
1163
docker exec -i app php --version
64+
```
1265

66+
Acessando o phpstan.
67+
```bash
1368
docker exec -i app phpstan --version
69+
```
1470

71+
Acessando o phpcs.
72+
```bash
1573
docker exec -i app phpcs --version
74+
```
1675

76+
Acessando o phpunit.
77+
```bash
1778
docker exec -i app phpunit --version
79+
```
1880

81+
Acessando o psalm.
82+
```bash
1983
docker exec -i app psalm --version
84+
```
2085

86+
Acessando o phploc.
87+
```bash
2188
docker exec -i app phploc --version
89+
```
2290

23-
docker exec -i app composer-unused
91+
Acessando o composer.
92+
```bash
93+
docker exec -i app composer --version
94+
```
2495

96+
Acessando o nodejs.
97+
```bash
2598
docker exec -i app node --version
99+
```
26100

27-
docker exec -i app npm --version
101+
Acessando o npm.
102+
```bash
103+
docker exec -i app npm --version
104+
```

Diff for: app/.gitignore

-5
This file was deleted.

Diff for: app/index.php

-3
This file was deleted.

Diff for: composer.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"autoload": {
3+
"psr-4": {
4+
"Vendor\\Namespace\\": ""
5+
}
6+
},
7+
"require": {
8+
"vlucas/phpdotenv": "^5.4"
9+
}
10+
}

Diff for: docker-compose.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ services:
55
build: .
66
container_name: app
77
volumes:
8-
- ./app:/var/www/html
8+
- .:/var/www/html
99
depends_on:
1010
- mysql
1111
- redis
@@ -17,7 +17,7 @@ services:
1717
ports:
1818
- "3306:3306"
1919
volumes:
20-
- "./mysql:/var/lib/mysql"
20+
- "./docker/mysql:/var/lib/mysql"
2121
environment:
2222
MYSQL_ROOT_PASSWORD: 'root'
2323
MYSQL_ROOT_HOST: "%"
@@ -26,18 +26,18 @@ services:
2626
MYSQL_PASSWORD: 'app'
2727

2828
nginx:
29-
build: ./nginx
29+
build: ./docker/nginx
3030
container_name: nginx
3131
restart: always
3232
ports:
3333
- "80:80"
3434
volumes:
35-
- ./app:/var/www/html
35+
- .:/var/www/html
3636
depends_on:
3737
- app
3838

3939
redis:
4040
image: redis:alpine
4141
container_name: redis
4242
expose:
43-
- 6379
43+
- 6379
File renamed without changes.

Diff for: nginx/nginx.conf renamed to docker/nginx/nginx.conf

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
server {
22
listen 80;
33
index index.php index.html;
4-
root /var/www/html;
4+
root /var/www/html/src/public;
55

66
location ~ \.php {
77
try_files $uri = 404;
@@ -16,4 +16,4 @@ server {
1616
try_files $uri $uri/ /index.php?$query_string;
1717
gzip_static on;
1818
}
19-
}
19+
}

Diff for: src/public/index.php

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
phpinfo();

0 commit comments

Comments
 (0)