From 5ed18338f77bd89d4967dcbb5c216ae9b46312d3 Mon Sep 17 00:00:00 2001 From: Nick <76625701+koevoet1221@users.noreply.github.com> Date: Thu, 16 Oct 2025 17:51:00 +0200 Subject: [PATCH 1/3] Fix the build error in #23 by starting mongodb before building and allowing the builder access to mongodb --- README.md | 4 ++-- docker-compose.yml | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e190e26..182ec11 100644 --- a/README.md +++ b/README.md @@ -185,7 +185,7 @@ MONGODB_URI=mongodb://root:example@mongodb:27017/openstock?authSource=admin 4) Start the stack: ```bash # from the repository root -docker compose up -d --build +docker compose up -d mongodb && docker compose up -d --build ``` 5) Access the app: @@ -257,7 +257,7 @@ Local (Docker Compose) MongoDB: NODE_ENV=development # Database (Docker) -MONGODB_URI=mongodb://root:example@mongodb:27017/openstock?authSource=admin +MONGODB_URI=mongodb://root:example@127.0.0.1:27017/openstock?authSource=admin # Better Auth BETTER_AUTH_SECRET=your_better_auth_secret diff --git a/docker-compose.yml b/docker-compose.yml index b08fe1a..16ad864 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,8 @@ services: openstock: - build: . + build: + context: . + network: host ports: - "3000:3000" env_file: From c35d930f21a4ca7a1ede2216e53640f9c3f521fe Mon Sep 17 00:00:00 2001 From: Nick <76625701+koevoet1221@users.noreply.github.com> Date: Thu, 16 Oct 2025 18:30:29 +0200 Subject: [PATCH 2/3] use a host mapping so that mongodb resolves to 127.0.0.1 in the builder --- README.md | 2 +- docker-compose.yml | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 182ec11..e63925e 100644 --- a/README.md +++ b/README.md @@ -257,7 +257,7 @@ Local (Docker Compose) MongoDB: NODE_ENV=development # Database (Docker) -MONGODB_URI=mongodb://root:example@127.0.0.1:27017/openstock?authSource=admin +MONGODB_URI=mongodb://root:example@mongodb:27017/openstock?authSource=admin # Better Auth BETTER_AUTH_SECRET=your_better_auth_secret diff --git a/docker-compose.yml b/docker-compose.yml index 16ad864..8632b80 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,6 +3,8 @@ services: build: context: . network: host + extra_hosts: + - "mongodb=127.0.0.1" ports: - "3000:3000" env_file: From 844307ca634ff7085f24b166ef735bbccaa60161 Mon Sep 17 00:00:00 2001 From: Nick <76625701+koevoet1221@users.noreply.github.com> Date: Thu, 16 Oct 2025 17:00:59 +0000 Subject: [PATCH 3/3] Update docker-compose.yml Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- docker-compose.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 8632b80..7a10df8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,9 +2,8 @@ services: openstock: build: context: . - network: host extra_hosts: - - "mongodb=127.0.0.1" + - "mongodb:host-gateway" ports: - "3000:3000" env_file: