diff --git a/build/bench/Dockerfile b/build/bench/Dockerfile index 2cceb3b6..7d051e55 100644 --- a/build/bench/Dockerfile +++ b/build/bench/Dockerfile @@ -54,8 +54,6 @@ 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 \ @@ -74,21 +72,27 @@ RUN groupadd -g 1000 frappe \ && useradd --no-log-init -r -m -u 1000 -g 1000 -G sudo frappe \ && echo "frappe ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers +# Set user, workdir and home USER frappe WORKDIR /home/frappe +ENV HOME=/home/frappe +# Export python executables for Dockerfile +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 +# Install pyenv for using multi python setup +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}" +RUN pyenv install 3.7.12 \ + && pyenv install 2.7.18 \ + && pyenv global system 3.7.12 2.7.18 # Clone and install bench in the local user home directory # For development, bench source is located in ~/.bench RUN git clone ${GIT_REPO} --depth 1 -b ${GIT_BRANCH} .bench \ && pip install --user -e .bench -# Export python executables for Dockerfile -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 \ @@ -105,12 +109,6 @@ RUN wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | && 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 FROM build as test diff --git a/development/README.md b/development/README.md index 8ae52b5a..c4b6ca11 100644 --- a/development/README.md +++ b/development/README.md @@ -62,7 +62,7 @@ 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` +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 python3.7 frappe-bench` ### Setup hosts