From 86d138e8e3a54e68242a4a1f9b0a8fd7f3419b44 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Sat, 20 Oct 2018 00:54:21 -0400 Subject: [PATCH 1/2] bench setup anything-else should work now (#56) --- dbench | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/dbench b/dbench index 446064fb..0eb66e5c 100755 --- a/dbench +++ b/dbench @@ -6,14 +6,13 @@ elif [ "$1" == 'init' ]; then docker exec -itu root frappe bash -c "cd /home/frappe && chown -R frappe:frappe ./*" docker exec -i frappe bash -c "cd .. && bench init frappe-bench --ignore-exist --skip-redis-config-generation && cd frappe-bench" docker exec -i frappe bash -c "mv Procfile_docker Procfile && mv sites/common_site_config_docker.json sites/common_site_config.json && bench set-mariadb-host mariadb" -elif [ "$1" == 'setup' ]; then - if [ "$2" == 'docker' ]; then +elif [ "$1" == 'setup' ] && [ "$2" == 'docker' ]; then if [ "$3" == '--swarm-mode' ]; then echo "Docker swarm mode is not currently supported" else docker-compose up -d fi - elif [ "$2" == 'hosts' ]; then +elif [ "$1" == 'setup' ] && [ "$2" == 'hosts' ]; then a=$(cd frappe-bench && ls sites/*/site_config.json | grep -o '/.\+/') a="${a//$'\n'/ }" a=$(echo $a | tr -d / ) @@ -21,7 +20,6 @@ elif [ "$1" == 'setup' ]; then echo $result | sudo tee -a /etc/hosts docker exec -iu root frappe bash -c "echo ${result} | tee --append /etc/hosts" docker exec -itu root frappe bash -c "printf '# User rules for frappe\nfrappe ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers.d/frappe" - fi elif [ "$1" == '-c' ]; then shift user=$1 From 687ef7cecc4faaed13c02c4bf6644e4bbd6139b6 Mon Sep 17 00:00:00 2001 From: William Moreno Date: Mon, 22 Oct 2018 01:11:59 -0600 Subject: [PATCH 2/2] Clean cache to get a smaller image (#57) Please include this commit to decrease the size of the docker image, the "rm -rf /var/lib/apt/lists/*" it is not usefull if it is not used in the same stage of the apt-get install RUN, similar with pip cache. References: - https://linux.die.net/man/8/apt-get - https://stackoverflow.com/questions/9510474/removing-pips-cache - https://semaphoreci.com/blog/2016/12/13/lightweight-docker-images-in-5-steps.html By making a contribution to this project, I certify that: (a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; (b) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved. Signed-off-by: William Moreno Reyes --- Dockerfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index d653bc99..f37a1eb0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,8 +11,9 @@ ENV LANG C.UTF-8 RUN apt-get update && apt-get install -y iputils-ping git build-essential python-setuptools python-dev libffi-dev libssl-dev libjpeg8-dev \ redis-tools redis-server software-properties-common libxrender1 libxext6 xfonts-75dpi xfonts-base zlib1g-dev libfreetype6-dev \ liblcms2-dev libwebp-dev python-tk apt-transport-https libsasl2-dev libldap2-dev libtiff5-dev tcl8.6-dev tk8.6-dev \ - wget libmysqlclient-dev mariadb-client mariadb-common curl rlwrap redis-tools nano wkhtmltopdf python-pip vim sudo -RUN pip install --upgrade setuptools pip + wget libmysqlclient-dev mariadb-client mariadb-common curl rlwrap redis-tools nano wkhtmltopdf python-pip vim sudo && apt-get clean \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --upgrade setuptools pip && rm -rf ~/.cache/pip RUN useradd -ms /bin/bash -G sudo frappe && printf '# User rules for frappe\nfrappe ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers.d/frappe #nodejs @@ -25,10 +26,9 @@ WORKDIR /home/frappe RUN git clone -b master https://github.com/frappe/bench.git bench-repo USER root -RUN pip install -e bench-repo \ +RUN pip install -e bench-repo && rm -rf ~/.cache/pip \ && npm install -g yarn \ - && chown -R frappe:frappe /home/frappe/* \ - && rm -rf /var/lib/apt/lists/* + && chown -R frappe:frappe /home/frappe/* USER frappe WORKDIR /home/frappe/frappe-bench