Skip to content

Instantly share code, notes, and snippets.

@pipech
Created November 30, 2018 09:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pipech/473f908a9f39fc8c2512c4bc94de59ac to your computer and use it in GitHub Desktop.
Save pipech/473f908a9f39fc8c2512c4bc94de59ac to your computer and use it in GitHub Desktop.
ERPNext Docker Debian - Without easy install
FROM debian:9.6-slim
ENV systemUser=frappe \
# locale
LANGUAGE=English \
LC_ALL=en_US.UTF-8 \
LC_CTYPE=en_US.UTF-8 \
LANG=en_US.UTF-8 \
# package version
nodejsVersion=8
# install prerequisite
RUN apt-get -y update \
&& apt-get -y install \
# essential
curl \
cron \
sudo \
locales \
# for production
supervisor \
nginx \
# -----------------------------------------------------
# bench/playbooks/install.py
# https://github.com/frappe/bench/blob/b9f750fc428cd20ebcf796b4beb8e562ee9f1b5b/playbooks/install.py#L17
# -----------------------------------------------------
wget \
git \
build-essential \
python-setuptools \
python-dev \
libffi-dev \
libssl-dev \
python-pip \
# -----------------------------------------------------
# bench/playbooks/roles/common/tasks/debian_family.yml
# https://github.com/frappe/bench/blob/b9f750fc428cd20ebcf796b4beb8e562ee9f1b5b/playbooks/roles/common/tasks/debian_family.yml#L7
# -----------------------------------------------------
# dnsmasq \ not necessary?? > small caching DNS proxy and DHCP/TFTP server
fontconfig \
# git \ duplicate
# htop \ not necessary?? > interactive processes viewer
libcrypto++-dev \
libfreetype6-dev \
# liblcms2-dev \ not necessary?? > little CMS 2 color management library development headers
# libssl-dev \ duplicate
# libwebp-dev \ not necessary?? > lossy compression of digital photographic images
libxext6 \
libxrender1 \
libxslt1-dev \
libxslt1.1 \
# libffi-dev \ duplicate
ntp \
# postfix \ skip for now
# python-dev \ duplicate
# python3-dev \ now using python 2
# python-tk \ not necessary?? > Tkinter - Writing Tk applications with Python
# screen \ not necessary?? > terminal multiplexer with VT100/ANSI terminal emulation
vim \
xfonts-75dpi \
xfonts-base \
zlib1g-dev \
apt-transport-https \
libsasl2-dev \
libldap2-dev \
libcups2-dev \
# pv \ not necessary?? > shell pipeline element to meter data passing through
# -----------------------------------------------------
# bench/playbooks/roles/common/tasks/debian.yml
# https://github.com/frappe/bench/blob/b9f750fc428cd20ebcf796b4beb8e562ee9f1b5b/playbooks/roles/common/tasks/debian.yml#L17
# -----------------------------------------------------
libjpeg62-turbo-dev \
libtiff5-dev \
tcl8.5-dev \
tk8.5-dev \
# -----------------------------------------------------
# bench/playbooks/roles/wkhtmltopdf/tasks/main.yml
# https://github.com/frappe/bench/blob/b9f750fc428cd20ebcf796b4beb8e562ee9f1b5b/playbooks/roles/wkhtmltopdf/tasks/main.yml#L13
# -----------------------------------------------------
# libxrender1 \ duplicate
# libxext6 \ duplicate
# xfonts-75dpi \ duplicate
# xfonts-base \ duplicate
wkhtmltopdf=0.12.3.2-3 \
# -----------------------------------------------------
# bench/playbooks/roles/nodejs/tasks/debian_family.yml
# https://github.com/frappe/bench/blob/b9f750fc428cd20ebcf796b4beb8e562ee9f1b5b/playbooks/roles/nodejs/tasks/debian_family.yml#L1
# -----------------------------------------------------
&& curl -sL https://deb.nodesource.com/setup_$nodejsVersion.x | bash - \
&& apt-get install -y nodejs \
&& npm install -g yarn \
# -----------------------------------------------------
# bench/playbooks/install.py
# https://github.com/frappe/bench/blob/b9f750fc428cd20ebcf796b4beb8e562ee9f1b5b/playbooks/install.py#L54
# -----------------------------------------------------
&& pip install \
setuptools \
cryptography \
requests \
# -----------------------------------------------------
# bench/playbooks/roles/common/tasks/debian.yml
# https://github.com/frappe/bench/blob/b9f750fc428cd20ebcf796b4beb8e562ee9f1b5b/playbooks/roles/common/tasks/debian.yml#L4
# -----------------------------------------------------
pyOpenSSL==16.2.0 \
# installation clean up
&& apt-get autoremove --purge \
&& apt-get clean
# Set locales
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen \
&& locale-gen
# add system user
RUN adduser --disabled-password --gecos "" $systemUser \
&& usermod -aG sudo $systemUser \
&& echo "%sudo ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/sudoers
# set user and workdir
USER $systemUser
WORKDIR /home/$systemUser
# bench env
ENV benchPath=bench-repo \
benchRepo='https://github.com/frappe/bench' \
benchBranch=master \
frappeRepo='https://github.com/frappe/frappe' \
frappeBranch=master \
# for python 2 use = python
# for python 3 use = python3 or python3.6 for centos
pythonVersion=python \
benchFolderName=bench \
erpnextRepo='https://github.com/frappe/erpnext' \
erpnextBranch=master \
siteName=site1.local \
branch=master \
adminPass=12345
# install bench
RUN git clone --branch $benchBranch --depth 1 --origin upstream $benchRepo $benchPath \
&& sudo pip install -e $benchPath \
&& bench init $benchFolderName \
--frappe-path $frappeRepo \
--frappe-branch $frappeBranch \
--python $pythonVersion \
--skip-redis-config-generation \
--verbose \
# cd to bench folder and start mysql service
&& cd $benchFolderName \
# install erpnext
&& bench get-app erpnext $erpnextRepo --branch $erpnextBranch \
# fix for Setup failed >> Could not start up: Error in setup
&& bench update --patch \
# delete unnecessary frappe apps
&& rm -rf \
apps/frappe_io \
apps/foundation \
&& sed -i '/foundation\|frappe_io/d' sites/apps.txt \
# delete unnecessary frappe apps git folder
&& rm -rf \
apps/frappe/.git \
apps/erpnext/.git
# expose port
EXPOSE 8000-8005 9000-9005 3306-3307
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment