From 96a7a50d7c1fd8f62337ddd6b411b29c98ba58bc Mon Sep 17 00:00:00 2001 From: JJ-Cronos Date: Wed, 15 May 2024 16:54:22 +0200 Subject: [PATCH] feat: RAFNAV docker image --- devcontainer-example/devcontainer.json | 32 +++++++++++++++++++++++++- development/apps-example.json | 28 ++++++++++++++++++++-- development/installer.py | 16 ++++++------- images/bench/Dockerfile | 27 ++++++++++++++-------- images/custom/Containerfile | 13 +++++++++-- 5 files changed, 94 insertions(+), 22 deletions(-) diff --git a/devcontainer-example/devcontainer.json b/devcontainer-example/devcontainer.json index 2e60f65d..0cce4c52 100644 --- a/devcontainer-example/devcontainer.json +++ b/devcontainer-example/devcontainer.json @@ -9,7 +9,37 @@ "ms-vscode.live-server", "grapecity.gc-excelviewer", "mtxr.sqltools", - "visualstudioexptteam.vscodeintellicode" + "visualstudioexptteam.vscodeintellicode", + "deinsoftware.arrow-function-snippets", + "formulahendry.auto-rename-tag", + "aaron-bond.better-comments", + "joy-yu.css-snippets", + "mikestead.dotenv", + "vincaslt.highlight-matching-tag", + "njpwerner.autodocstring", + "ms-python.black-formatter", + "streetsidesoftware.code-spell-checker", + "dbaeumer.vscode-eslint", + "tamasfe.even-better-toml", + "github.vscode-github-actions", + "ecmel.vscode-html-css", + "wix.vscode-import-cost", + "oderwat.indent-rainbow", + "DavidAnson.vscode-markdownlint", + "christian-kohler.npm-intellisense", + "quicktype.quicktype", + "christian-kohler.path-intellisense", + "Postman.postman-for-vscode", + "esbenp.prettier-vscode", + "ms-python.vscode-pylance", + "ms-python.debugpy", + "donjayamanne.python-environment-manager", + "mechatroner.rainbow-csv", + "charliermarsh.ruff", + "jasonnutter.search-node-modules", + "redhat.vscode-xml", + "DotJoshJohnson.xml", + "redhat.vscode-yaml" ], "settings": { "terminal.integrated.profiles.linux": { diff --git a/development/apps-example.json b/development/apps-example.json index 513d3d10..13d5bfdf 100644 --- a/development/apps-example.json +++ b/development/apps-example.json @@ -1,6 +1,30 @@ [ { - "url": "https://github.com/frappe/erpnext.git", - "branch": "version-15" + "url": "https://github.com/cronos-capital/LMS.git", + "branch": "main" + }, + { + "url": "https://github.com/cronos-capital/RAFNAV_ERP.git", + "branch": "main" + }, + { + "url": "https://github.com/cronos-capital/raf_finance.git", + "branch": "main" + }, + { + "url": "https://github.com/cronos-capital/matter_management.git", + "branch": "main" + }, + { + "url": "https://github.com/cronos-capital/documentation.git", + "branch": "main" + }, + { + "url": "https://github.com/cronos-capital/filing.git", + "branch": "main" + }, + { + "url": "https://github.com/cronos-capital/LRMS.git", + "branch": "main" } ] diff --git a/development/installer.py b/development/installer.py index 44aca431..49bf1255 100755 --- a/development/installer.py +++ b/development/installer.py @@ -48,16 +48,16 @@ def get_args_parser(): "--bench-name", action="store", type=str, - help="Bench directory name, default: frappe-bench", - default="frappe-bench", + help="Bench directory name, default: rafnav_dev", + default="rafnav_dev", ) # noqa: E501 parser.add_argument( "-s", "--site-name", action="store", type=str, - help="Site name, should end with .localhost, default: development.localhost", # noqa: E501 - default="development.localhost", + help="Site name, should end with .localhost, default: rafnav.localhost", # noqa: E501 + default="rafnav.localhost", ) parser.add_argument( "-r", @@ -80,16 +80,16 @@ def get_args_parser(): "--py-version", action="store", type=str, - help="python version, default: Not Set", # noqa: E501 - default=None, + help="python version, default: 3.12.3", # noqa: E501 + default="3.12.3", ) parser.add_argument( "-n", "--node-version", action="store", type=str, - help="node version, default: Not Set", # noqa: E501 - default=None, + help="node version, default: 20.13.1", # noqa: E501 + default="20.13.1", ) parser.add_argument( "-v", diff --git a/images/bench/Dockerfile b/images/bench/Dockerfile index ec7078e2..faaec0a2 100644 --- a/images/bench/Dockerfile +++ b/images/bench/Dockerfile @@ -97,7 +97,7 @@ WORKDIR /home/frappe # Install Python via pyenv ENV PYTHON_VERSION_V14=3.10.13 -ENV PYTHON_VERSION=3.11.6 +ENV PYTHON_VERSION=3.12.3 ENV PYENV_ROOT /home/frappe/.pyenv ENV PATH $PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH @@ -122,27 +122,36 @@ RUN git clone ${GIT_REPO} --depth 1 -b ${GIT_BRANCH} .bench \ && echo "export PATH=/home/frappe/.local/bin:\$PATH" >>/home/frappe/.bashrc \ && echo "export BENCH_DEVELOPER=1" >>/home/frappe/.bashrc +# Install homebrew and wget +RUN /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" \ + && (echo; echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"') >> /home/frappe/.profile \ + && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" \ + && brew install gcc \ + && brew install wget + +# Add aliases +RUN touch $HOME/.bash_aliases \ + && echo "alias py='python'" >> $HOME/.bash_aliases \ + && echo "alias frap-install='py installer.py'" >> $HOME/.bash_aliases + # Install Node via nvm -ENV NODE_VERSION_14=16.20.2 -ENV NODE_VERSION=18.18.2 +ENV NODE_VERSION_STABLE=16.20.2 +ENV NODE_VERSION=20.13.1 ENV NVM_DIR /home/frappe/.nvm ENV PATH ${NVM_DIR}/versions/node/v${NODE_VERSION}/bin/:${PATH} RUN wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash \ && . ${NVM_DIR}/nvm.sh \ - && nvm install ${NODE_VERSION_14} \ - && nvm use v${NODE_VERSION_14} \ + && nvm install ${NODE_VERSION_STABLE} \ + && nvm use v${NODE_VERSION_STABLE} \ && npm install -g yarn \ - && nvm install ${NODE_VERSION} \ - && nvm use v${NODE_VERSION} \ + && nvm install v${NODE_VERSION} \ && npm install -g yarn \ - && nvm alias default v${NODE_VERSION} \ && rm -rf ${NVM_DIR}/.cache \ && echo 'export NVM_DIR="/home/frappe/.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 - EXPOSE 8000-8005 9000-9005 6787 FROM bench as bench-test diff --git a/images/custom/Containerfile b/images/custom/Containerfile index e7d281fc..8190ef60 100644 --- a/images/custom/Containerfile +++ b/images/custom/Containerfile @@ -1,4 +1,4 @@ -ARG PYTHON_VERSION=3.11.6 +ARG PYTHON_VERSION=3.12.3 ARG DEBIAN_BASE=bookworm FROM python:${PYTHON_VERSION}-slim-${DEBIAN_BASE} AS base @@ -44,7 +44,7 @@ RUN useradd -ms /bin/bash frappe \ && nvm install ${NODE_VERSION} \ && nvm use v${NODE_VERSION} \ && npm install -g yarn \ - && nvm alias default v${NODE_VERSION} \ + && nvm install --lts \ && rm -rf ${NVM_DIR}/.cache \ && echo 'export NVM_DIR="/home/frappe/.nvm"' >>/home/frappe/.bashrc \ && echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm' >>/home/frappe/.bashrc \ @@ -72,6 +72,15 @@ RUN useradd -ms /bin/bash frappe \ && chmod 755 /usr/local/bin/nginx-entrypoint.sh \ && chmod 644 /templates/nginx/frappe.conf.template +# Install homebrew and wget +RUN /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" \ + && brew install wget + +# Add aliases +RUN touch $HOME/.bash_aliases \ + && echo "alias py='python'" >> $HOME/.bash_aliases \ + && echo "alias frap-install='py installer.py'" >> $HOME/.bash_aliases + FROM base AS builder RUN apt-get update \