Skip to content

Commit

Permalink
Fix issue #451: Configure host address for optional exposure outside …
Browse files Browse the repository at this point in the history
…container in Docker (#460)

* Add Docker support with network exposure

* Add Docker support with network exposure

* Revise changeset

* Update to include optional exposure to devices on local network by updating HOST_BIND env variable
  • Loading branch information
glassBead-tc authored Jan 3, 2025
1 parent 567b65f commit 36913a4
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .changeset/dirty-hotels-press.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
'srcbook': patch
---

Added configurable network exposure for Docker deployments with secure defaults. This includes:

- Added docker-compose.yml with configurable network binding
- Default configuration restricts access to localhost (127.0.0.1) for security
- Optional network exposure via HOST_BIND environment variable
- Configured port 2150 mapping for Docker container

Users can optionally expose their Srcbook instance to other network devices by setting HOST_BIND=0.0.0.0 when running Docker.
19 changes: 19 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: '3'
services:
srcbook:
build:
context: .
dockerfile: Dockerfile
ports:
- "${HOST_BIND:-127.0.0.1}:2150:2150"
volumes:
- type: bind
source: ~/.srcbook
target: /root/.srcbook
bind:
create_host_path: true
environment:
- NODE_ENV=production
- HOST=${HOST_BIND:-127.0.0.1}
- SRCBOOK_INSTALL_DEPS=true
command: ["pnpm", "start"]

0 comments on commit 36913a4

Please sign in to comment.