diff --git a/Dockerfile b/Dockerfile index 08bdb117..bdd68d79 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,6 +6,7 @@ MAINTAINER Vishal Seshagiri USER root RUN apt-get update +RUN apt-get install -y iputils-ping RUN apt-get install -y git build-essential python-setuptools python-dev libffi-dev libssl-dev RUN apt-get install -y redis-tools software-properties-common libxrender1 libxext6 xfonts-75dpi xfonts-base RUN apt-get install -y libjpeg8-dev 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 @@ -18,6 +19,7 @@ RUN apt-get install -y rlwrap RUN apt-get install redis-server RUN apt-get install -y nano + #nodejs RUN apt-get install curl RUN curl https://deb.nodesource.com/node_6.x/pool/main/n/nodejs/nodejs_6.7.0-1nodesource1~xenial1_amd64.deb > node.deb \ @@ -27,33 +29,14 @@ RUN apt-get install -y wkhtmltopdf USER frappe WORKDIR /home/frappe -RUN git clone https://github.com/frappe/bench bench-repo USER root -RUN pip install -e bench-repo -RUN apt-get install -y libmysqlclient-dev mariadb-client mariadb-common - -#Scripts to be added to docker file -#USER frappe -#RUN bench init frappe-bench && cd frappe-bench +RUN cd /home/frappe #USER root -#RUN cd /home/frappe -#RUN ls -l -# frappe-bench apps sites -# - -# On the host machine run -# docker ps - to get the id of mariadb container -# docker inspect -# get the IP address of the mariadb container which looks similar to this - -# In the docker frappe container run -# bench set-mariadb-host 172.20.0.2 - - -#RUN bench new-site site1 -#RUN bench get-app erpnext https://github.com/frappe/erpnext -#RUN bench --site site1 install-app erpnext -#RUN bench start +#RUN pip install -e bench-repo +#RUN apt-get install -y libmysqlclient-dev mariadb-client mariadb-common +#RUN chown -R frappe:frappe /home/frappe +#USER frappe +#RUN bench init frappe-bench && cd frappe-bench diff --git a/README.md b/README.md index 7256efd9..ff3f43fe 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ The docker-compose version used by us is docker-compose version 1.14.0, build c7 Steps to be followed to build and run the docker image are : ``` -1. Run the bash script setup-frappe.sh (Modify it to executable if not already given using the chmod +x command) with the command ./setup-frappe.sh +1. Run the start-container script 2. After a few minutes the prompt will point to the App container with a root prefix to it (your current location is /home/frappe) 3. You will be inside /home/frappe/code folder 4. Make the bash_run_container.sh executable by chmod +x as in step 1 and run it with the command ./bash_run_container.sh @@ -46,15 +46,13 @@ Steps to be followed to build and run the docker image are : 6. You will be prompted to enter the Mysql db password it is 123 7. You will be prompted to choose and enter an administrator password please enter and remember it for future use 8. Once all the installation steps are complete you can access the Web based GUI by typing localhost:8000 on your browser. -``` - ## Built With * [Docker](https://www.docker.com/) ## Contributing -Feel free to contribute to this and make the process better +Feel free to contribute to this and make the container better ## Authors diff --git a/code/bash_run_container.sh b/code/bash_run_container.sh deleted file mode 100755 index 88b85561..00000000 --- a/code/bash_run_container.sh +++ /dev/null @@ -1,3 +0,0 @@ -chown -R frappe:frappe /home/frappe/code/bash_for_container.sh -chmod +x /home/frappe/code/bash_for_container.sh -su frappe diff --git a/docker-compose.yml b/docker-compose.yml index 6c1beb47..9e1c8f3a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,7 +3,7 @@ services: mariadb: image: "mariadb" environment: - - MYSQL_ROOT_PASSWORD=123 + - MYSQL_ROOT_PASSWORD=${DB_PASS} - MYSQL_USER=root volumes: - ./conf/mariadb-conf.d:/etc/mysql/conf.d @@ -14,18 +14,17 @@ services: image: "redis:alpine" frappe: + volumes: + - ./frappe:/home/frappe build: . ports: - - "8000:5000" + - "8000:8000" stdin_open: true tty: true - #links: - # - redis - # - mariadb - network_mode: "host" + links: + - redis + - mariadb depends_on: - - "mariadb" - - "redis" - volumes: - - ./code:/home/frappe/code - + - mariadb + - redis + diff --git a/frappe/setup.sh b/frappe/setup.sh new file mode 100755 index 00000000..4538d09b --- /dev/null +++ b/frappe/setup.sh @@ -0,0 +1,9 @@ +#USER root +cd /home/frappe +git clone https://github.com/frappe/bench bench-repo +pip install -e bench-repo +apt-get install -y libmysqlclient-dev mariadb-client mariadb-common +chown -R frappe:frappe /home/frappe + +#USER frappe +su frappe diff --git a/setup-frappe.sh b/setup-frappe.sh deleted file mode 100755 index 0901c316..00000000 --- a/setup-frappe.sh +++ /dev/null @@ -1,13 +0,0 @@ -docker-compose up -d -db_id=`docker ps | grep "mariadb" | awk '{print $1}'` -db_ip=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress }}' $db_id` -app_id=`docker ps | grep docker_frappe | awk {'print $1'}` -app_ip=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress }}' $app_id` -echo 'cd ../' >> ./bash_for_container.sh -echo 'bench init frappe-bench && cd frappe-bench' >> ./bash_for_container.sh -echo 'bench set-mariadb-host '$db_ip >> ./bash_for_container.sh -echo 'bench new-site site1' >> bash_for_container.sh -echo 'bench --site site1 install-app erpnext' >> bash_for_container.sh -echo 'bench start' >> bash_for_container.sh -docker cp bash_for_container.sh $app_id:/home/frappe/code -docker exec -it $app_id bash -c 'cd /home/frappe/code; exec "${SHELL:-sh}"' diff --git a/start-container.sh b/start-container.sh new file mode 100755 index 00000000..2c600b05 --- /dev/null +++ b/start-container.sh @@ -0,0 +1,11 @@ +echo "Enter a password for your database " +read DB_PASS + +echo 'export DB_PASS='$DB_PASS >> ~/.bashrc +source ~/.bashrc + +docker-compose up -d +app_id=`docker ps | grep docker_frappe | awk {'print $1'}` + +docker exec -it $app_id bash -c './setup.sh; exec "${SHELL:-sh}"' +