2
0
mirror of https://github.com/frappe/frappe_docker.git synced 2024-11-09 23:00:56 +00:00

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

View File

@ -413,4 +413,5 @@ echo -e "\e[1m\e[4mCheck bench --help\e[0m"
docker run \
-v frappebench00_sites-vol:/home/frappe/frappe-bench/sites \
--network frappebench00_default \
--user frappe \
frappe/erpnext-worker:edge bench --help

View File

@ -23,7 +23,6 @@ services:
erpnext-nginx:
image: frappe/erpnext-nginx:edge
restart: on-failure
environment:
- FRAPPE_PY=erpnext-python
- FRAPPE_PY_PORT=8000