Skip to content

Commit 6eccf87

Browse files
Merge pull request #559 from liberusoftware/copilot/replace-docker-build-setup
Replace Docker setup with laravel-docktane, fix MySQL test pipeline
2 parents 5883588 + 1b6846a commit 6eccf87

File tree

7 files changed

+157
-5
lines changed

7 files changed

+157
-5
lines changed

.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Homestead.yaml
6565
Homestead.json
6666
/.vagrant
6767
rr
68-
.rr.yaml
68+
# .rr.yaml should not be excluded - it's needed for RoadRunner
6969

7070
# Backup files
7171
*.bak

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
run: cp .env.testing .env
4343

4444
- name: Install dependencies
45-
run: composer install --no-progress --prefer-dist --with-all-dependencies
45+
run: composer install --no-progress --prefer-dist
4646

4747
- name: Generate application key
4848
run: php artisan key:generate

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Homestead.json
2727
/.vagrant
2828
.phpunit.result.cache
2929
rr
30-
.rr.yaml
30+
# .rr.yaml is tracked in git (needed for RoadRunner configuration)
3131

3232
# Backup files
3333
*.bak

.rr.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
version: "3"
2+
3+
rpc:
4+
listen: tcp://127.0.0.1:6001
5+
6+
http:
7+
address: 0.0.0.0:80
8+
middleware: ["static", "headers", "gzip"]
9+
pool:
10+
num_workers: 4
11+
max_jobs: 64
12+
supervisor:
13+
max_worker_memory: 128
14+
uploads:
15+
forbid: [".php", ".exe", ".bat"]
16+
static:
17+
dir: "public"
18+
forbid: [".php", ".htaccess"]
19+
headers:
20+
response:
21+
X-Powered-By: "PHP/Laravel"
22+
23+
logs:
24+
mode: production
25+
level: warn
26+
channels:
27+
http:
28+
mode: production
29+
level: warn
30+
server:
31+
mode: production
32+
level: warn
33+
rpc:
34+
mode: production
35+
level: warn

docker-compose.yml

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
services:
2+
app:
3+
build:
4+
context: .
5+
dockerfile: Dockerfile
6+
args:
7+
PHP_VERSION: '8.3'
8+
WWWUSER: '${WWWUSER:-1000}'
9+
WWWGROUP: '${WWWGROUP:-1000}'
10+
image: boilerplate-laravel:latest
11+
ports:
12+
- '${APP_PORT:-8000}:80'
13+
environment:
14+
CONTAINER_MODE: http
15+
OCTANE_SERVER: roadrunner
16+
WITH_SCHEDULER: 'true'
17+
WITH_HORIZON: 'false'
18+
RUNNING_MIGRATIONS_AND_SEEDERS: '${RUNNING_MIGRATIONS_AND_SEEDERS:-false}'
19+
env_file:
20+
- .env
21+
volumes:
22+
- storage:/var/www/html/storage/app
23+
- logs:/var/www/html/storage/logs
24+
depends_on:
25+
mysql:
26+
condition: service_healthy
27+
redis:
28+
condition: service_healthy
29+
networks:
30+
- appnet
31+
32+
worker:
33+
build:
34+
context: .
35+
dockerfile: Dockerfile
36+
args:
37+
PHP_VERSION: '8.3'
38+
image: boilerplate-laravel:latest
39+
environment:
40+
CONTAINER_MODE: worker
41+
WORKER_COMMAND: 'php /var/www/html/artisan queue:work --sleep=3 --tries=3 --max-time=3600'
42+
env_file:
43+
- .env
44+
volumes:
45+
- storage:/var/www/html/storage/app
46+
- logs:/var/www/html/storage/logs
47+
depends_on:
48+
mysql:
49+
condition: service_healthy
50+
redis:
51+
condition: service_healthy
52+
networks:
53+
- appnet
54+
profiles:
55+
- worker
56+
57+
mysql:
58+
image: mysql:8.0
59+
ports:
60+
- '${FORWARD_DB_PORT:-3306}:3306'
61+
environment:
62+
MYSQL_ROOT_PASSWORD: '${DB_PASSWORD:-secret}'
63+
MYSQL_DATABASE: '${DB_DATABASE:-liberu}'
64+
MYSQL_USER: '${DB_USERNAME:-liberu}'
65+
MYSQL_PASSWORD: '${DB_PASSWORD:-secret}'
66+
volumes:
67+
- mysql:/var/lib/mysql
68+
networks:
69+
- appnet
70+
healthcheck:
71+
test: ['CMD', 'mysqladmin', 'ping', '-h', 'localhost']
72+
interval: 10s
73+
timeout: 5s
74+
retries: 5
75+
76+
redis:
77+
image: redis:7-alpine
78+
ports:
79+
- '${FORWARD_REDIS_PORT:-6379}:6379'
80+
volumes:
81+
- redis:/data
82+
networks:
83+
- appnet
84+
healthcheck:
85+
test: ['CMD', 'redis-cli', 'ping']
86+
interval: 10s
87+
timeout: 5s
88+
retries: 5
89+
90+
mailpit:
91+
image: axllent/mailpit:latest
92+
ports:
93+
- '${FORWARD_MAIL_PORT:-1025}:1025'
94+
- '${FORWARD_MAILPIT_DASHBOARD_PORT:-8025}:8025'
95+
networks:
96+
- appnet
97+
98+
networks:
99+
appnet:
100+
driver: bridge
101+
102+
volumes:
103+
mysql:
104+
driver: local
105+
redis:
106+
driver: local
107+
storage:
108+
driver: local
109+
logs:
110+
driver: local

phpunit.xml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,12 @@
2121
<env name="APP_ENV" value="testing"/>
2222
<env name="BCRYPT_ROUNDS" value="4"/>
2323
<env name="CACHE_DRIVER" value="array"/>
24-
<env name="DB_CONNECTION" value="sqlite"/>
25-
<env name="DB_DATABASE" value=":memory:"/>
24+
<env name="DB_CONNECTION" value="mysql"/>
25+
<env name="DB_HOST" value="localhost"/>
26+
<env name="DB_PORT" value="3306"/>
27+
<env name="DB_DATABASE" value="liberu"/>
28+
<env name="DB_USERNAME" value="root"/>
29+
<env name="DB_PASSWORD" value="root"/>
2630
<env name="MAIL_MAILER" value="array"/>
2731
<env name="PULSE_ENABLED" value="false"/>
2832
<env name="QUEUE_CONNECTION" value="sync"/>

tests/Feature/SearchTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,5 +196,8 @@
196196
}
197197

198198
$response->assertStatus(429);
199+
200+
// Clear rate limiter cache to avoid affecting subsequent tests
201+
\Illuminate\Support\Facades\Cache::flush();
199202
});
200203
});

0 commit comments

Comments
 (0)