Skip to content

Commit

Permalink
Merge pull request #34 from likesistemas/feature/docker-v2
Browse files Browse the repository at this point in the history
Atualizando `docker compose` para v2
  • Loading branch information
ricardoapaes authored Sep 11, 2024
2 parents 56b4be7 + 18fef77 commit c1a9211
Show file tree
Hide file tree
Showing 16 changed files with 60 additions and 56 deletions.
34 changes: 25 additions & 9 deletions .github/workflows/docker-publish-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ jobs:
test:
strategy:
matrix:
PHP: [73, 74, 80, 81, 82, 83]
PHP: [74, 80, 81, 82, 83]

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Prepare code
env:
Expand All @@ -38,7 +38,7 @@ jobs:
env:
PHP_VERSION: ${{ matrix.PHP }}
run: |
docker-compose \
docker compose \
--file docker-compose.yml \
--file docker-compose-${PHP_VERSION}.yml \
--file docker-compose.dev.yml \
Expand All @@ -48,7 +48,7 @@ jobs:
env:
PHP_VERSION: ${{ matrix.PHP }}
run: |
echo $(docker run -t --network lemp jwilder/dockerize \
echo $(docker run --rm -t --network lemp jwilder/dockerize \
-wait http://core_nginx/ \
-timeout 60s)
Expand All @@ -59,6 +59,14 @@ jobs:
docker ps -a
docker logs app
- name: Add Config PHP Version
env:
PHP_VERSION: ${{ matrix.PHP }}
run: |
docker compose -f docker-compose.yml \
-f docker-compose-${PHP_VERSION}.yml \
exec app add-new-config php version ${PHP_VERSION}
- name: Test -> Http Request
env:
PHP_VERSION: ${{ matrix.PHP }}
Expand Down Expand Up @@ -87,7 +95,7 @@ jobs:
env:
PHP_VERSION: ${{ matrix.PHP }}
run: |
docker-compose \
docker compose \
--file docker-compose.yml \
--file docker-compose-${PHP_VERSION}.yml \
--file docker-compose.dev.yml \
Expand All @@ -97,7 +105,7 @@ jobs:
env:
PHP_VERSION: ${{ matrix.PHP }}
run: |
docker-compose \
docker compose \
--file docker-compose.yml \
--file docker-compose-${PHP_VERSION}.yml \
--file docker-compose.dev.yml \
Expand All @@ -108,7 +116,7 @@ jobs:
env:
PHP_VERSION: ${{ matrix.PHP }}
run: |
echo $(docker run -t --network lemp jwilder/dockerize \
echo $(docker run --rm -t --network lemp jwilder/dockerize \
-wait http://core_nginx/ \
-timeout 60s)
Expand All @@ -118,6 +126,14 @@ jobs:
run: |
docker ps -a
docker logs app
- name: Add Config PHP Version
env:
PHP_VERSION: ${{ matrix.PHP }}
run: |
docker compose -f docker-compose.yml \
-f docker-compose-${PHP_VERSION}.yml \
exec app add-new-config php version ${PHP_VERSION}
- name: Production -> Http test
env:
Expand Down Expand Up @@ -148,13 +164,13 @@ jobs:

strategy:
matrix:
PHP: [73, 74, 80, 81, 82, 83]
PHP: [74, 80, 81, 82, 83]

runs-on: ubuntu-latest
if: github.event_name == 'push'

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
Expand Down
42 changes: 29 additions & 13 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ jobs:
test:
strategy:
matrix:
PHP: [73, 74, 80, 81, 82, 83]
PHP: [74, 80, 81, 82, 83]

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Prepare code
env:
Expand All @@ -38,15 +38,15 @@ jobs:
env:
PHP_VERSION: ${{ matrix.PHP }}
run: |
docker-compose -f docker-compose.yml \
docker compose -f docker-compose.yml \
-f docker-compose-${PHP_VERSION}.yml \
up --build -d
- name: Wait environment
env:
PHP_VERSION: ${{ matrix.PHP }}
run: |
echo $(docker run -t --network lemp jwilder/dockerize \
echo $(docker run --rm -t --network lemp jwilder/dockerize \
-wait http://core_nginx/ \
-timeout 60s)
Expand All @@ -57,6 +57,14 @@ jobs:
docker ps -a
docker logs app
- name: Add Config PHP Version
env:
PHP_VERSION: ${{ matrix.PHP }}
run: |
docker compose -f docker-compose.yml \
-f docker-compose-${PHP_VERSION}.yml \
exec app add-new-config php version ${PHP_VERSION}
- name: Test -> Http request
env:
PHP_VERSION: ${{ matrix.PHP }}
Expand Down Expand Up @@ -85,7 +93,7 @@ jobs:
env:
PHP_VERSION: ${{ matrix.PHP }}
run: |
docker-compose -f docker-compose.yml \
docker compose -f docker-compose.yml \
-f docker-compose-${PHP_VERSION}.yml \
down -v
Expand All @@ -94,7 +102,7 @@ jobs:
PHP_VERSION: ${{ matrix.PHP }}
run: |
APP_RUN=$(
docker-compose -f docker-compose.yml \
docker compose -f docker-compose.yml \
-f docker-compose-${PHP_VERSION}.yml \
run -w /var/www/ --entrypoint entrypoint-app app echo
)
Expand All @@ -110,12 +118,12 @@ jobs:
env:
PHP_VERSION: ${{ matrix.PHP }}
run: |
docker-compose -f docker-compose.yml \
docker compose -f docker-compose.yml \
-f docker-compose-${PHP_VERSION}.yml \
-f docker-compose-config-disabled.yml \
up --build -d
echo $(docker run -t --network lemp jwilder/dockerize \
echo $(docker run --rm -t --network lemp jwilder/dockerize \
-wait http://core_nginx/ \
-timeout 60s)
Expand All @@ -131,7 +139,7 @@ jobs:
exit 1;
fi
docker-compose -f docker-compose.yml \
docker compose -f docker-compose.yml \
-f docker-compose-${PHP_VERSION}.yml \
-f docker-compose-config-disabled.yml \
down -v
Expand All @@ -140,7 +148,7 @@ jobs:
env:
PHP_VERSION: ${{ matrix.PHP }}
run: |
docker-compose -f docker-compose.yml \
docker compose -f docker-compose.yml \
-f docker-compose-${PHP_VERSION}.yml \
-f docker-compose.prod.yml \
up --build -d
Expand All @@ -149,7 +157,7 @@ jobs:
env:
PHP_VERSION: ${{ matrix.PHP }}
run: |
echo $(docker run -t --network lemp jwilder/dockerize \
echo $(docker run --rm -t --network lemp jwilder/dockerize \
-wait http://core_nginx/ \
-timeout 60s)
Expand All @@ -160,6 +168,14 @@ jobs:
docker ps -a
docker logs app
- name: Add Config PHP Version
env:
PHP_VERSION: ${{ matrix.PHP }}
run: |
docker compose -f docker-compose.yml \
-f docker-compose-${PHP_VERSION}.yml \
exec app add-new-config php version ${PHP_VERSION}
- name: Test -> Http test
env:
PHP_VERSION: ${{ matrix.PHP }}
Expand Down Expand Up @@ -189,13 +205,13 @@ jobs:

strategy:
matrix:
PHP: [73, 74, 80, 81, 82, 83]
PHP: [74, 80, 81, 82, 83]

runs-on: ubuntu-latest
if: github.event_name == 'push'

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# sistema-core ![PHP 5.6](https://github.com/likesistemas/sistema-core/workflows/PHP%205.6/badge.svg) ![PHP 5.6 dev](https://github.com/likesistemas/sistema-core/workflows/PHP%205.6%20dev/badge.svg) ![PHP 7.3](https://github.com/likesistemas/sistema-core/workflows/PHP%207.3/badge.svg) ![PHP 7.3 dev](https://github.com/likesistemas/sistema-core/workflows/PHP%207.3%20dev/badge.svg) ![PHP 8.0](https://github.com/likesistemas/sistema-core/workflows/PHP%208.0/badge.svg) ![PHP 8.0 dev](https://github.com/likesistemas/sistema-core/workflows/PHP%208.0%20dev/badge.svg)
# sistema-core [![PHP](https://github.com/likesistemas/sistema-core/actions/workflows/docker-publish.yml/badge.svg)](https://github.com/likesistemas/sistema-core/actions/workflows/docker-publish.yml) [![PHP](https://github.com/likesistemas/sistema-core/actions/workflows/docker-publish.yml/badge.svg)](https://github.com/likesistemas/sistema-core/actions/workflows/docker-publish.yml) [![PHP](https://github.com/likesistemas/sistema-core/actions/workflows/docker-publish.yml/badge.svg)](https://github.com/likesistemas/sistema-core/actions/workflows/docker-publish.yml) [![PHP](https://github.com/likesistemas/sistema-core/actions/workflows/docker-publish.yml/badge.svg)](https://github.com/likesistemas/sistema-core/actions/workflows/docker-publish.yml) [![PHP](https://github.com/likesistemas/sistema-core/actions/workflows/docker-publish.yml/badge.svg)](https://github.com/likesistemas/sistema-core/actions/workflows/docker-publish.yml)
2 changes: 0 additions & 2 deletions docker-compose-56.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3.5'

services:

nginx:
Expand Down
2 changes: 0 additions & 2 deletions docker-compose-73.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3.5'

services:

nginx:
Expand Down
2 changes: 0 additions & 2 deletions docker-compose-74.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3.5'

services:

nginx:
Expand Down
3 changes: 0 additions & 3 deletions docker-compose-80.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
version: '3.5'

services:

app:
command: app create && add-new-config php version 8.0
environment:
- DB_HOST_SLAVE=mysql_slave
- MEMCACHE_HOST=memcache
Expand Down
3 changes: 0 additions & 3 deletions docker-compose-81.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
version: '3.5'

services:

app:
command: app create && add-new-config php version 8.1
environment:
- DB_HOST_SLAVE=mysql_slave
- MEMCACHE_HOST=memcache
Expand Down
3 changes: 0 additions & 3 deletions docker-compose-82.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
version: '3.5'

services:

app:
command: app create && add-new-config php version 8.2
environment:
- DB_HOST_SLAVE=mysql_slave
- MEMCACHE_HOST=memcache
Expand Down
3 changes: 0 additions & 3 deletions docker-compose-83.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
version: '3.5'

services:

app:
command: app create && add-new-config php version 8.3
environment:
- DB_HOST_SLAVE=mysql_slave
- MEMCACHE_HOST=memcache
Expand Down
2 changes: 0 additions & 2 deletions docker-compose-config-disabled.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3.5'

services:

app:
Expand Down
2 changes: 0 additions & 2 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3.5'

services:

app:
Expand Down
2 changes: 0 additions & 2 deletions docker-compose.prod.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3.5'

services:

app:
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: '3.5'
networks:
lemp:
name: lemp
Expand Down Expand Up @@ -32,9 +31,10 @@ services:
- mysql
depends_on:
- mysql
restart: on-failure

mysql:
image: mysql:5.5
image: mariadb:latest
command: --innodb-use-native-aio=0
volumes:
- core-mysql-data:/var/lib/mysql
Expand Down
4 changes: 2 additions & 2 deletions k6/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# K6.io

Para rodar os testes iniciar o PHP usando o docker-compose da versão escolhida e executar o k6 como o exemplo abaixo usando o PHP 7.3.
Para rodar os testes iniciar o PHP usando o `docker compose` da versão escolhida e executar o k6 como o exemplo abaixo usando o PHP 7.3.

```shell
docker-compose -f docker-compose-73.yml up --build -d
docker compose -f docker-compose-73.yml up --build -d
k6 run -e PHP_VERSION=73 --vus 40 --duration 30s index.js
```

Expand Down
6 changes: 1 addition & 5 deletions www80/public/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

$versaoPhp = explode('.', phpversion());
$versaoPhpFormatada = $versaoPhp[0] . $versaoPhp[1];
$versaoPhpFormatadaComPonto = $versaoPhp[0] . '.' . $versaoPhp[1];

$config = parse_ini_file(__DIR__ . "/../config.ini", true);

Expand All @@ -26,9 +25,6 @@
'password' => '',
'bd' => ''
],
'php' => [
'version' => $versaoPhpFormatadaComPonto
]
];

$expectedConfig = [
Expand All @@ -53,7 +49,7 @@
'secret' => '78910'
],
'php' => [
'version' => $versaoPhpFormatadaComPonto
'version' => $versaoPhpFormatada
]
];

Expand Down

0 comments on commit c1a9211

Please sign in to comment.