Skip to content

Commit 345d558

Browse files
author
Philipp Kübler
committed
add startup command example
1 parent f46b6b4 commit 345d558

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,37 @@ Make sure to adjust your `.env` accordingly and set `APP_URL` to `http://localho
6969

7070
Run `docker-compose up` to start the services.
7171

72+
### Startup Commands
73+
74+
Further commands can be defined via ENV variable `STARTUP_COMMANDXXX`, which are executed at container start before the actual command.
75+
76+
The commands must be numbered sequentially and start with 1 (e.g. `STARTUP_COMMAND1=command`, `STARTUP_COMMAND2=...`).
77+
78+
```yml
79+
version: '3.7'
80+
services:
81+
app:
82+
image: sourceboat/docker-laravel
83+
command: /home/app/run-prod.sh
84+
restart: unless-stopped
85+
environment:
86+
- PHP_OPCACHE_VALIDATE_TIMESTAMPS=1
87+
- PHP_MEMORY_LIMIT=1G
88+
- STARTUP_COMMAND1=php artisan migrate --force
89+
- STARTUP_COMMAND2=php artisan horizon:restart
90+
volumes:
91+
- ./:/opt/app:cached
92+
ports:
93+
- "8080:8080"
94+
depends_on:
95+
- mysql
96+
mysql:
97+
image: mysql:8.0
98+
environment:
99+
- "MYSQL_ROOT_PASSWORD=secret"
100+
- "MYSQL_DATABASE=default"
101+
```
102+
72103
### Production
73104

74105
`WIP`
@@ -80,6 +111,7 @@ Check [releases](https://github.com/sourceboat/docker-laravel/releases) for all
80111
## Credits
81112

82113
- [Phil-Bastian Berndt](https://github.com/pehbehbeh)
114+
- [Philipp Kübler](https://github.com/PKuebler)
83115
- [All Contributors](https://github.com/sourceboat/docker-laravel/graphs/contributors)
84116

85117
## License

0 commit comments

Comments
 (0)