fix: accept args for bench commands

This commit is contained in:
Revant Nandgaonkar
2020-08-30 00:06:56 +05:30
parent 358e1ca7c9
commit e9080d3952
5 changed files with 22 additions and 9 deletions

19
build/common/worker/bench Executable file
View File

@@ -0,0 +1,19 @@
#!/home/frappe/frappe-bench/env/bin/python
import subprocess
import sys
import os
if __name__ == "__main__":
bench_dir = os.path.join(os.sep, 'home', 'frappe', 'frappe-bench')
sites_dir = os.path.join(bench_dir, 'sites')
bench_helper = os.path.join(
bench_dir, 'apps', 'frappe',
'frappe', 'utils', 'bench_helper.py',
)
cwd = os.getcwd()
os.chdir(sites_dir)
subprocess.check_call(
[sys.executable, bench_helper, 'frappe'] + sys.argv[1:],
)

View File

@@ -201,15 +201,8 @@ elif [ "$1" = 'restore-backup' ]; then
&& python /home/frappe/frappe-bench/commands/restore_backup.py"
exit
elif [ "$1" = 'bench' ]; then
exec su frappe -c '/home/frappe/frappe-bench/env/bin/python \
/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py \
frappe "$@"'
exit
else
exec su frappe -c "$@"
exec $@
fi

View File

@@ -57,6 +57,7 @@ USER root
COPY build/common/commands/* /home/frappe/frappe-bench/commands/
COPY build/common/common_site_config.json.template /opt/frappe/common_site_config.json.template
COPY build/common/worker/install_app.sh /usr/local/bin/install_app
COPY build/common/worker/bench /usr/local/bin/bench
# Setup docker-entrypoint
COPY build/common/worker/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh