From 1af9dbb0832fc22b19822959b391e638b7150b15 Mon Sep 17 00:00:00 2001 From: sabaimran Date: Fri, 19 Jul 2024 17:10:08 +0530 Subject: [PATCH] Switch node/yarn install steps to use more native installation patterns --- Dockerfile | 18 +++++++++--------- prod.Dockerfile | 14 +++++++------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Dockerfile b/Dockerfile index 693db86b..cdaf3c14 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,18 +1,18 @@ # syntax=docker/dockerfile:1 FROM ubuntu:jammy -LABEL "homepage" "https://khoj.dev" -LABEL "repository" "https://github.com/khoj-ai/khoj" -LABEL "org.opencontainers.image.source" "https://github.com/khoj-ai/khoj" +LABEL homepage="https://khoj.dev" +LABEL repository="https://github.com/khoj-ai/khoj" +LABEL org.opencontainers.image.source="https://github.com/khoj-ai/khoj" # Install System Dependencies RUN apt update -y && apt -y install python3-pip swig curl -# Install Node.js and Yarn -RUN curl -sL https://deb.nodesource.com/setup_22.x | bash - -RUN apt -y install nodejs -RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - -RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list -RUN apt update && apt -y install yarn +# Install Node.js and Yarn using nvm in a single RUN instruction +RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash - && \ + export NVM_DIR="$HOME/.nvm" && \ + [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" && \ + nvm install 20 && \ + npm install --global yarn # Install RapidOCR dependencies RUN apt -y install libgl1 libgl1-mesa-glx libglib2.0-0 diff --git a/prod.Dockerfile b/prod.Dockerfile index f767ee93..820593c7 100644 --- a/prod.Dockerfile +++ b/prod.Dockerfile @@ -1,16 +1,16 @@ FROM ubuntu:jammy -LABEL org.opencontainers.image.source https://github.com/khoj-ai/khoj +LABEL org.opencontainers.image.source="https://github.com/khoj-ai/khoj" # Install System Dependencies RUN apt update -y && apt -y install python3-pip libsqlite3-0 ffmpeg libsm6 libxext6 swig curl -# Install Node.js and Yarn -RUN curl -sL https://deb.nodesource.com/setup_22.x | bash - -RUN apt -y install nodejs -RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - -RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list -RUN apt update && apt -y install yarn +# Install Node.js and Yarn using nvm in a single RUN instruction +RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash - && \ + export NVM_DIR="$HOME/.nvm" && \ + [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" && \ + nvm install 20 && \ + npm install --global yarn WORKDIR /app