diff --git a/build/bench/Dockerfile b/build/bench/Dockerfile index f7cdaeb8..2cceb3b6 100644 --- a/build/bench/Dockerfile +++ b/build/bench/Dockerfile @@ -54,6 +54,8 @@ RUN apt-get update \ ssh-client \ # VSCode container requirements net-tools \ + # For version 12 + python2 \ && rm -rf /var/lib/apt/lists/* RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen \ @@ -85,6 +87,8 @@ ENV PATH /home/frappe/.local/bin:$PATH # Export python executables for interactive shell RUN echo "export PATH=/home/frappe/.local/bin:\$PATH" >> /home/frappe/.bashrc +ENV HOME=/home/frappe + # Install nvm with node RUN wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash \ && . ${NVM_DIR}/nvm.sh \ @@ -96,7 +100,16 @@ RUN wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | && nvm use v${NODE_VERSION} \ && npm install -g yarn \ && nvm alias default v${NODE_VERSION} \ - && rm -rf ${NVM_DIR}/.cache + && rm -rf ${NVM_DIR}/.cache \ + && echo 'export NVM_DIR="$HOME/.nvm"' >> ~/.bashrc \ + && echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm' >> ~/.bashrc \ + && echo '[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion' >> ~/.bashrc + +RUN git clone --depth=1 https://github.com/pyenv/pyenv.git .pyenv +ENV PYENV_ROOT="${HOME}/.pyenv" +ENV PATH="${PYENV_ROOT}/shims:${PYENV_ROOT}/bin:${PATH}" +ENV PYTHON_VERSION=3.7.12 +RUN pyenv install ${PYTHON_VERSION} EXPOSE 8000-8005 9000-9005 6787 diff --git a/development/README.md b/development/README.md index c73d73f0..8ae52b5a 100644 --- a/development/README.md +++ b/development/README.md @@ -62,6 +62,8 @@ bench init --skip-redis-config-generation --frappe-branch version-13 frappe-benc cd frappe-bench ``` +Note: For version 12 use python 3.7 by passing option to `bench init` command, e.g. `bench init --skip-redis-config-generation --frappe-branch version-12 --python ~/.pyenv/versions/3.7.12/bin/python frappe-bench` + ### Setup hosts We need to tell bench to use the right containers instead of localhost. Run the following commands inside the container: