2
0
mirror of https://github.com/frappe/frappe_docker.git synced 2024-12-24 11:05:29 +00:00

fix: add nodejs via nvm

This commit is contained in:
Revant Nandgaonkar 2020-08-05 21:40:37 +05:30
parent d5c6e9cd99
commit 6b94d991e2
3 changed files with 21 additions and 3 deletions

View File

@ -71,6 +71,10 @@ fi
# Allow user process to create files in logs directory
chown -R frappe:frappe /home/frappe/frappe-bench/logs
# symlink node_modules
ln -s /home/frappe/frappe-bench/sites/assets/frappe/node_modules \
/home/frappe/frappe-bench/apps/frappe/node_modules
if [ "$1" = 'start' ]; then
configureEnv
checkConnection

View File

@ -8,7 +8,7 @@ function nodeCleanUp() {
cd /home/frappe/frappe-bench/apps/frappe
yarn
yarn run production
yarn add nunjucks -D
yarn add nunjucks node-sass -D
if [[ "$GIT_BRANCH" =~ ^(version-12|version-11)$ ]]; then
nodeCleanUp

View File

@ -4,6 +4,9 @@ RUN useradd -ms /bin/bash frappe
ARG GIT_BRANCH=develop
ENV PYTHONUNBUFFERED 1
ENV NVM_DIR=/home/frappe/.nvm
ENV NODE_VERSION=14.7.0
ENV PATH="/home/frappe/.nvm/versions/node/v${NODE_VERSION}/bin/:${PATH}"
# Install dependencies
WORKDIR /home/frappe/frappe-bench
@ -27,7 +30,17 @@ RUN install_packages \
libpq-dev \
&& wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.buster_amd64.deb \
&& dpkg -i wkhtmltox_0.12.5-1.buster_amd64.deb && rm wkhtmltox_0.12.5-1.buster_amd64.deb \
&& apt-get purge -y wget && apt-get autoremove -y
&& wget https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh \
&& apt-get purge -y wget && apt-get autoremove -y \
&& chown -R frappe:frappe /home/frappe
USER frappe
# Install nvm with node
RUN bash install.sh \
&& . "$NVM_DIR/nvm.sh" \
&& nvm install ${NODE_VERSION} \
&& nvm use v${NODE_VERSION} \
&& nvm alias default v${NODE_VERSION}
# Create frappe-bench directories
RUN mkdir -p apps logs commands /home/frappe/backups
@ -39,6 +52,7 @@ RUN python -m venv env \
&& git clone --depth 1 -o upstream https://github.com/frappe/frappe --branch ${GIT_BRANCH} \
&& pip3 install --no-cache-dir -e /home/frappe/frappe-bench/apps/frappe
USER root
# Copy scripts and templates
COPY build/common/commands/* /home/frappe/frappe-bench/commands/
COPY build/common/common_site_config.json.template /opt/frappe/common_site_config.json.template
@ -52,7 +66,7 @@ RUN ln -s /usr/local/bin/docker-entrypoint.sh / # backwards compat
WORKDIR /home/frappe/frappe-bench/sites
# Set ownership of sites directory
RUN chown -R frappe:frappe /home/frappe/frappe-bench/sites /home/frappe/backups
RUN chown -R frappe:frappe /home/frappe/frappe-bench/sites
VOLUME [ "/home/frappe/frappe-bench/sites", "/home/frappe/backups" ]