From 7d3d0e03c6970ec84d8aa5425d620817f487ea7a Mon Sep 17 00:00:00 2001 From: timothycarambat Date: Wed, 1 Nov 2023 22:12:30 -0700 Subject: [PATCH] bind docker to docker/.env so dumps persist between restarts --- .dockerignore | 1 + docker/.env.example | 15 +++++++-------- docker/Dockerfile | 1 + docker/HOW_TO_USE_DOCKER.md | 2 +- docker/docker-compose.yml | 1 + 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/.dockerignore b/.dockerignore index 959f9541..f02837a0 100644 --- a/.dockerignore +++ b/.dockerignore @@ -11,4 +11,5 @@ collector/outputs/** **/__pycache__/ **/.env **/.env.* +!docker/.env.example !frontend/.env.production \ No newline at end of file diff --git a/docker/.env.example b/docker/.env.example index cef05311..4ab09a1e 100644 --- a/docker/.env.example +++ b/docker/.env.example @@ -5,9 +5,9 @@ CACHE_VECTORS="true" ########################################### ######## LLM API SElECTION ################ ########################################### -LLM_PROVIDER='openai' +# LLM_PROVIDER='openai' # OPEN_AI_KEY= -OPEN_MODEL_PREF='gpt-3.5-turbo' +# OPEN_MODEL_PREF='gpt-3.5-turbo' # LLM_PROVIDER='azure' # AZURE_OPENAI_ENDPOINT= @@ -36,13 +36,13 @@ OPEN_MODEL_PREF='gpt-3.5-turbo' # CHROMA_API_KEY="sk-123abc" # Enable all below if you are using vector database: Pinecone. -VECTOR_DB="lancedb" -PINECONE_ENVIRONMENT= -PINECONE_API_KEY= -PINECONE_INDEX= +# VECTOR_DB="pinecone" +# PINECONE_ENVIRONMENT= +# PINECONE_API_KEY= +# PINECONE_INDEX= # Enable all below if you are using vector database: LanceDB. -# VECTOR_DB="lancedb" +VECTOR_DB="lancedb" # Enable all below if you are using vector database: Weaviate. # VECTOR_DB="weaviate" @@ -58,6 +58,5 @@ PINECONE_INDEX= # AUTH_TOKEN="hunter2" # This is the password to your application if remote hosting. # NO_DEBUG="true" STORAGE_DIR="/app/server/storage" -GOOGLE_APIS_KEY= UID='1000' GID='1000' diff --git a/docker/Dockerfile b/docker/Dockerfile index a6729b76..28578cbd 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -37,6 +37,7 @@ RUN groupadd -g $ARG_GID anythingllm && \ # Copy docker helper scripts COPY ./docker/docker-entrypoint.sh /usr/local/bin/ COPY ./docker/docker-healthcheck.sh /usr/local/bin/ +COPY --chown=anythingllm:anythingllm ./docker/.env.example /app/server/.env # Ensure the scripts are executable RUN chmod +x /usr/local/bin/docker-entrypoint.sh && \ diff --git a/docker/HOW_TO_USE_DOCKER.md b/docker/HOW_TO_USE_DOCKER.md index 2cc5a41e..b6a7f02a 100644 --- a/docker/HOW_TO_USE_DOCKER.md +++ b/docker/HOW_TO_USE_DOCKER.md @@ -9,7 +9,7 @@ Use the Dockerized version of AnythingLLM for a much faster and complete startup - `git clone` this repo and `cd anything-llm` to get to the root directory. - `touch server/storage/anythingllm.db` to create empty SQLite DB file. - `cd docker/` -- `cp .env.example .env` +- `cp .env.example .env` **you must do this before building** - `docker-compose up -d --build` to build the image - this will take a few moments. Your docker host will show the image as online once the build process is completed. This will build the app to `http://localhost:3001`. diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index d9972426..ba1632aa 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -18,6 +18,7 @@ services: ARG_UID: ${UID} ARG_GID: ${GID} volumes: + - "./.env:/app/server/.env" - "../server/storage:/app/server/storage" - "../collector/hotdir/:/app/collector/hotdir" - "../collector/outputs/:/app/collector/outputs"