diff --git a/.dockerignore b/.dockerignore index ce69589..441b043 100644 --- a/.dockerignore +++ b/.dockerignore @@ -101,4 +101,3 @@ frontend/dist !package.json !yarn.lock !.yarnrc - diff --git a/Dockerfile b/Dockerfile index 3c6fafb..6202b20 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,20 +20,22 @@ RUN apt-get update -y && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* + +# Install node from upstream, ubuntu packages are too old +RUN curl -sL https://deb.nodesource.com/setup_18.x | bash +RUN apt-get install -y nodejs && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + + +# Install node package manager yarn +RUN npm install -g yarn + + # Install ollama llm inference engine COPY --from=ollama /usr/bin/ollama /usr/local/ollama/bin/ollama ENV PATH="/usr/local/ollama/bin:${PATH}" -# RUN curl https://ollama.ai/install.sh | sh - -# Upgrade pip -RUN python3 -m pip install --upgrade pip -# Install fastapi and web server -RUN pip install fastapi -RUN pip install "uvicorn[standard]" - -# RAG framework haystack -# RUN pip install "sentence-transformers>=2.2.0" # Pull a language model (see LICENSE_STABLELM2.txt) ARG MODEL=stablelm2:1.6b-zephyr @@ -47,6 +49,7 @@ RUN ollama serve & while ! curl http://localhost:11434; do sleep 1; done; ollama # COPY --chmod=644 Modelfile Modelfile # RUN curl --location https://huggingface.co/TheBloke/DiscoLM_German_7b_v1-GGUF/resolve/main/discolm_german_7b_v1.Q5_K_S.gguf?download=true --output discolm_german_7b_v1.Q5_K_S.gguf; ollama serve & while ! curl http://localhost:11434; do sleep 1; done; ollama create ${MODEL} -f Modelfile && rm -rf /tmp/model + # Setup the custom API and frontend WORKDIR /workspace @@ -54,41 +57,25 @@ WORKDIR /workspace COPY --chmod=755 requirements.txt requirements.txt RUN pip install -r requirements.txt + # Install frontend dependencies COPY --chmod=755 frontend/package.json frontend/package.json COPY --chmod=755 frontend/yarn.lock frontend/yarn.lock -# RUN cd frontend && yarn install - -# Copy and build frontend for production (into the frontend/dist folder) -COPY --chmod=755 frontend frontend -# RUN cd frontend && yarn build +RUN cd frontend && yarn install -# Copy backend for production -COPY --chmod=644 gswikichat gswikichat # Copy data COPY --chmod=755 json_input json_input -# Install node from upstream, ubuntu packages are too old -RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash - -# Install node from upstream, ubuntu packages are too old -RUN curl -sL https://deb.nodesource.com/setup_20.x | bash -RUN apt-get install -y nodejs && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists/* -RUN npm cache clean -f -RUN npm install -g n -RUN n 18.17.1 +# Copy backend for production +COPY --chmod=644 gswikichat gswikichat -# RUN node -v -# Install node package manager yarn -RUN npm install -g yarn +# Copy and build frontend for production (into the frontend/dist folder) +COPY --chmod=755 frontend frontend +RUN cd frontend && yarn build -# Install frontend dependencies and build it for production (into the frontend/dist folder) -RUN cd frontend && yarn install && yarn build # Container startup script COPY --chmod=755 start.sh /start.sh