2
0
mirror of https://github.com/frappe/frappe_docker.git synced 2024-09-18 18:19:02 +00:00

First working dockerization

This commit is contained in:
vishalseshagiri 2017-07-18 09:00:58 +00:00
commit 40fbff8e77
8 changed files with 152 additions and 0 deletions

59
Dockerfile Normal file
View File

@ -0,0 +1,59 @@
#bench Dockerfile
FROM ubuntu:16.04
MAINTAINER Vishal Seshagiri
USER root
RUN apt-get update
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
RUN apt-get install -y wget
RUN wget https://bootstrap.pypa.io/get-pip.py && python get-pip.py
RUN pip install --upgrade setuptools pip
RUN useradd -ms /bin/bash frappe
RUN apt-get install -y curl
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 \
&& dpkg -i node.deb \
&& rm node.deb
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
#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 <mariadb-container-id>
# 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

15
bash_script.sh Executable file
View File

@ -0,0 +1,15 @@
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 'export app_id='$app_id >> ~/.bashrc
source ~/.bashrc
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}"'

3
code/bash_run_container.sh Executable file
View File

@ -0,0 +1,3 @@
chown -R frappe:frappe /home/frappe/code/bash_for_container.sh
chmod +x /home/frappe/code/bash_for_container.sh
su frappe

View File

@ -0,0 +1,33 @@
# MariaDB-specific config file.
# Read by /etc/mysql/my.cnf
[client]
# Default is Latin1, if you need UTF-8 set this (also in server section)
#default-character-set = utf8
[mysqld]
#
# * Character sets
#
# Default is Latin1, if you need UTF-8 set all this (also in client section)
#
#character-set-server = utf8
#collation-server = utf8_general_ci
#character_set_server = utf8
#collation_server = utf8_general_ci
# Import all .cnf files from configuration directory
!includedir /etc/mysql/mariadb.conf.d/
[mysqld]
innodb-file-format=barracuda
innodb-file-per-table=1
innodb-large-prefix=1
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
[mysql]
default-character-set = utf8mb4

View File

@ -0,0 +1,2 @@
[mysql]

View File

@ -0,0 +1,4 @@
[mysqld_safe]
skip_log_error
syslog

View File

@ -0,0 +1,5 @@
[mysqldump]
quick
quote-names
max_allowed_packet = 16M

31
docker-compose.yml Normal file
View File

@ -0,0 +1,31 @@
version: '2'
services:
mariadb:
image: "mariadb"
environment:
- MYSQL_ROOT_PASSWORD=123
- MYSQL_USER=root
volumes:
- ./conf/mariadb-conf.d:/etc/mysql/conf.d
ports:
- "3306:3306"
redis:
image: "redis:alpine"
frappe:
build: .
ports:
- "8000:5000"
stdin_open: true
tty: true
#links:
# - redis
# - mariadb
network_mode: "host"
depends_on:
- "mariadb"
- "redis"
volumes:
- ./code:/home/frappe/code