From c823cef40564ffec7fe3be39b394319efae97798 Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 7 Feb 2025 14:25:09 +0000 Subject: [PATCH 1/7] fix: devcontainer codespaces correct api address --- .devcontainer/post-create-command.sh | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/.devcontainer/post-create-command.sh b/.devcontainer/post-create-command.sh index 93796b49..a378d043 100755 --- a/.devcontainer/post-create-command.sh +++ b/.devcontainer/post-create-command.sh @@ -2,7 +2,26 @@ set -e # Exit immediately if a command exits with a non-zero status -cp -n .env-template .env || true +# Create ../frontend/.env.development if it doesn't exist, based on a template in the root +if [ ! -f ../frontend/.env.development ]; then + cp -n .env-template ../frontend/.env.development || true # Assuming .env-template is in the root +fi + +# Determine VITE_API_HOST based on environment +if [ -n "$CODESPACES" ]; then + # Running in Codespaces + CODESPACE_NAME=$(echo "$CODESPACES" | cut -d'-' -f1) # Extract codespace name + PUBLIC_API_HOST="https://${CODESPACE_NAME}-7091.${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}" + echo "Setting VITE_API_HOST for Codespaces: $PUBLIC_API_HOST in ../frontend/.env.development" + sed -i "s|VITE_API_HOST=.*|VITE_API_HOST=$PUBLIC_API_HOST|" ../frontend/.env.development +else + # Not running in Codespaces (local devcontainer) + DEFAULT_API_HOST="http://localhost:7091" + echo "Setting VITE_API_HOST for local dev: $DEFAULT_API_HOST in ../frontend/.env.development" + sed -i "s|VITE_API_HOST=.*|VITE_API_HOST=$DEFAULT_API_HOST|" ../frontend/.env.development +fi + + mkdir -p model if [ ! -d model/all-mpnet-base-v2 ]; then wget -q https://d3dg1063dc54p9.cloudfront.net/models/embeddings/mpnet-base-v2.zip -O model/mpnet-base-v2.zip From ce69b09730b9d944e00fe139d0a729b3e78f2dfc Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 7 Feb 2025 14:30:15 +0000 Subject: [PATCH 2/7] fix: devcontainer paths --- .devcontainer/devcontainer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 664cf64d..b3cbf9e8 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,6 +1,6 @@ { "name": "DocsGPT Dev Container", - "dockerComposeFile": ["../docker-compose-dev.yaml", "docker-compose.override.yaml"], + "dockerComposeFile": ["../deployment/docker-compose-dev.yaml", "docker-compose.override.yaml"], "service": "dev", "workspaceFolder": "/workspace", "postCreateCommand": ".devcontainer/post-create-command.sh", From e3ebce117b703de42ccb92644cc9402c82058cd4 Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 7 Feb 2025 14:34:19 +0000 Subject: [PATCH 3/7] fix: devcontainer paths 2 --- .devcontainer/devcontainer.json | 2 +- .devcontainer/docker-compose-dev.yaml | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 .devcontainer/docker-compose-dev.yaml diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index b3cbf9e8..a86b8b66 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,6 +1,6 @@ { "name": "DocsGPT Dev Container", - "dockerComposeFile": ["../deployment/docker-compose-dev.yaml", "docker-compose.override.yaml"], + "dockerComposeFile": ["docker-compose-dev.yaml", "docker-compose.override.yaml"], "service": "dev", "workspaceFolder": "/workspace", "postCreateCommand": ".devcontainer/post-create-command.sh", diff --git a/.devcontainer/docker-compose-dev.yaml b/.devcontainer/docker-compose-dev.yaml new file mode 100644 index 00000000..8a3e75c4 --- /dev/null +++ b/.devcontainer/docker-compose-dev.yaml @@ -0,0 +1,18 @@ +services: + + redis: + image: redis:6-alpine + ports: + - 6379:6379 + + mongo: + image: mongo:6 + ports: + - 27017:27017 + volumes: + - mongodb_data_container:/data/db + + + +volumes: + mongodb_data_container: \ No newline at end of file From 6ff948c107b06619808910c6e3e8741fc462d38c Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 7 Feb 2025 14:35:44 +0000 Subject: [PATCH 4/7] fix: dockerfile in devcontainer build dir fix --- .devcontainer/docker-compose.override.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/docker-compose.override.yaml b/.devcontainer/docker-compose.override.yaml index 11db7289..dabd8ca7 100644 --- a/.devcontainer/docker-compose.override.yaml +++ b/.devcontainer/docker-compose.override.yaml @@ -4,7 +4,7 @@ services: dev: build: context: . - dockerfile: .devcontainer/Dockerfile + dockerfile: Dockerfile volumes: - .:/workspace:cached command: sleep infinity From 7356a2ff074a8be7d96e74175a1c2308d46c2ba9 Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 7 Feb 2025 18:39:07 +0000 Subject: [PATCH 5/7] fix: minor docker fixes --- .devcontainer/docker-compose.override.yaml | 2 +- application/Dockerfile | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.devcontainer/docker-compose.override.yaml b/.devcontainer/docker-compose.override.yaml index dabd8ca7..979bf48f 100644 --- a/.devcontainer/docker-compose.override.yaml +++ b/.devcontainer/docker-compose.override.yaml @@ -6,7 +6,7 @@ services: context: . dockerfile: Dockerfile volumes: - - .:/workspace:cached + - ../:/workspace:cached command: sleep infinity depends_on: redis: diff --git a/application/Dockerfile b/application/Dockerfile index 27213072..308b721b 100644 --- a/application/Dockerfile +++ b/application/Dockerfile @@ -6,7 +6,6 @@ ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && \ apt-get install -y software-properties-common && \ add-apt-repository ppa:deadsnakes/ppa && \ -# Install necessary packages and Python apt-get update && \ apt-get install -y --no-install-recommends gcc wget unzip libc6-dev python3.12 python3.12-venv && \ rm -rf /var/lib/apt/lists/* @@ -49,7 +48,6 @@ FROM ubuntu:24.04 as final RUN apt-get update && \ apt-get install -y software-properties-common && \ add-apt-repository ppa:deadsnakes/ppa && \ -# Install Python apt-get update && apt-get install -y --no-install-recommends python3.12 && \ ln -s /usr/bin/python3.12 /usr/bin/python && \ rm -rf /var/lib/apt/lists/* From fbad183d392664d4bc8982e351cf4ca40dc6f4fd Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 7 Feb 2025 18:44:24 +0000 Subject: [PATCH 6/7] fix: post create devcontainers --- .devcontainer/post-create-command.sh | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.devcontainer/post-create-command.sh b/.devcontainer/post-create-command.sh index a378d043..597b985e 100755 --- a/.devcontainer/post-create-command.sh +++ b/.devcontainer/post-create-command.sh @@ -2,9 +2,8 @@ set -e # Exit immediately if a command exits with a non-zero status -# Create ../frontend/.env.development if it doesn't exist, based on a template in the root -if [ ! -f ../frontend/.env.development ]; then - cp -n .env-template ../frontend/.env.development || true # Assuming .env-template is in the root +if [ ! -f frontend/.env.development ]; then + cp -n .env-template frontend/.env.development || true # Assuming .env-template is in the root fi # Determine VITE_API_HOST based on environment @@ -12,13 +11,13 @@ if [ -n "$CODESPACES" ]; then # Running in Codespaces CODESPACE_NAME=$(echo "$CODESPACES" | cut -d'-' -f1) # Extract codespace name PUBLIC_API_HOST="https://${CODESPACE_NAME}-7091.${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}" - echo "Setting VITE_API_HOST for Codespaces: $PUBLIC_API_HOST in ../frontend/.env.development" - sed -i "s|VITE_API_HOST=.*|VITE_API_HOST=$PUBLIC_API_HOST|" ../frontend/.env.development + echo "Setting VITE_API_HOST for Codespaces: $PUBLIC_API_HOST in frontend/.env.development" + sed -i "s|VITE_API_HOST=.*|VITE_API_HOST=$PUBLIC_API_HOST|" frontend/.env.development else # Not running in Codespaces (local devcontainer) DEFAULT_API_HOST="http://localhost:7091" - echo "Setting VITE_API_HOST for local dev: $DEFAULT_API_HOST in ../frontend/.env.development" - sed -i "s|VITE_API_HOST=.*|VITE_API_HOST=$DEFAULT_API_HOST|" ../frontend/.env.development + echo "Setting VITE_API_HOST for local dev: $DEFAULT_API_HOST in frontend/.env.development" + sed -i "s|VITE_API_HOST=.*|VITE_API_HOST=$DEFAULT_API_HOST|" frontend/.env.development fi From 5d17072709511eac89d4076e8fc3d9981659b7dc Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 7 Feb 2025 19:22:01 +0000 Subject: [PATCH 7/7] fix: readme space --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6795ddd8..0ae8ec99 100644 --- a/README.md +++ b/README.md @@ -101,7 +101,7 @@ On windows: 3. Run the following command: - ```bash + ```bash docker compose -f deployment/docker-compose.yaml up --build ``` 4. Navigate to http://localhost:5173/.