forked from aheadWorks/docker-phpdev
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentrypoint.py
More file actions
34 lines (28 loc) · 866 Bytes
/
entrypoint.py
File metadata and controls
34 lines (28 loc) · 866 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import click
import sys
import subprocess
@click.group(invoke_without_command=True, context_settings=dict(
ignore_unknown_options=True,
))
@click.argument('args', nargs=-1, type=click.UNPROCESSED)
@click.pass_context
def cli(ctx, args):
subprocess.check_call("sh /update-host-machine.sh", shell=True)
try:
if args[0] == 'serve':
ctx.invoke(serve)
except IndexError:
pass
try:
subprocess.check_call(list(args))
except subprocess.CalledProcessError as e:
sys.exit(e.returncode)
@cli.command()
def serve():
""" Run PHP-fpm, cron, nginx """
click.echo("Starting crond...")
subprocess.check_call("crond")
click.echo("Starting nginx & fpm...")
subprocess.check_call("nginx -g \"daemon off;\" & docker-php-entrypoint php-fpm -R", shell=True)
if __name__ == '__main__':
cli()