Skip to content

Commit 30c1785

Browse files
authored
Merge pull request #138 from stevo1403/docs/docker-setup-fixes
Improve Docker reliability and document compose usage
2 parents a6efe55 + 4220bd1 commit 30c1785

3 files changed

Lines changed: 34 additions & 33 deletions

File tree

README.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,18 +183,31 @@ npm install
183183
npm run dev # default :8080
184184
```
185185

186-
Or with Docker:
186+
Or with Docker (API + MCP):
187187

188188
```bash
189189
docker compose up --build -d
190190
```
191191

192+
Optional: include the dashboard service profile:
193+
194+
```bash
195+
docker compose --profile ui up --build -d
196+
```
197+
198+
Check service status:
199+
200+
```bash
201+
docker compose ps
202+
curl -f http://localhost:8080/health
203+
```
204+
192205
The backend exposes:
193206

194207
- `/api/memory/*` – memory operations
195208
- `/api/temporal/*` – temporal knowledge graph
196209
- `/mcp` – MCP server
197-
- dashboard UI
210+
- dashboard UI (when `ui` profile is enabled)
198211

199212
---
200213

@@ -552,4 +565,4 @@ Issues and PRs are welcome.
552565

553566
## 13. License
554567

555-
OpenMemory is licensed under **Apache 2.0**. See [LICENSE](LICENSE) for details.
568+
OpenMemory is licensed under **Apache 2.0**. See [LICENSE](LICENSE) for details.

docker-compose.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
version: '3.8'
2-
31
services:
42
openmemory:
53
build:
@@ -122,14 +120,22 @@ services:
122120
- openmemory_data:/data
123121
restart: unless-stopped
124122
healthcheck:
125-
test: ['CMD', 'wget', '--no-verbose', '--tries=1', '--spider', 'http://localhost:8080/health']
123+
test:
124+
[
125+
'CMD',
126+
'node',
127+
'-e',
128+
'require("http").get("http://localhost:8080/health",(res)=>process.exit(res.statusCode===200?0:1)).on("error",()=>process.exit(1))',
129+
]
126130
interval: 30s
127131
timeout: 10s
128132
retries: 3
129133
start_period: 30s
130134

131135
# Dashboard: Web UI for visualizing and managing memories
132136
dashboard:
137+
profiles:
138+
- ui
133139
build:
134140
context: ./dashboard
135141
dockerfile: Dockerfile

packages/openmemory-js/Dockerfile

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,31 @@
11
# ===== BUILD STAGE =====
2-
FROM node:20-alpine AS builder
2+
FROM node:20-bookworm-slim AS builder
33

44
WORKDIR /app
55

6-
# Install system dependencies required for native module compilation,
7-
# plus curl and bash (needed to run the Bun installation script)
8-
RUN apk add --no-cache python3 make g++ curl bash
9-
10-
# Install Bun globally and relocate it to a shared, persistent location
11-
RUN curl -fsSL https://bun.sh/install | bash \
12-
&& mv /root/.bun /opt/bun \
13-
&& ln -s /opt/bun/bin/bun /usr/local/bin/bun
14-
15-
# Ensure Bun is available in PATH for subsequent commands
16-
ENV PATH="/opt/bun/bin:${PATH}"
17-
186
# Copy package manifests to install dependencies
197
COPY package*.json ./
208

21-
# Install all dependencies (including devDependencies) using Bun
22-
# --frozen-lockfile ensures reproducible builds
23-
# --concurrent-scripts and --network-concurrency optimize install speed
24-
RUN bun install --frozen-lockfile
9+
# Install all dependencies (including devDependencies) for build
10+
RUN npm ci
2511

2612
# Copy source code and build the application
2713
COPY src/ ./src/
2814
COPY tsconfig.json ./
29-
RUN bun run build
15+
RUN NODE_OPTIONS="--max-old-space-size=4096" npm run build
3016

31-
# Remove devDependencies to reduce image size
32-
# (Removing all the devDependencies that we dont need in the final build)
17+
# Remove devDependencies to reduce image size for the runtime image
3318
RUN npm prune --omit=dev
3419

3520

3621
# ===== PRODUCTION STAGE =====
37-
FROM node:20-alpine AS production
22+
FROM node:20-bookworm-slim AS production
3823

3924
WORKDIR /app
4025

41-
# Install timezone data for proper TZ support
42-
RUN apk add --no-cache tzdata
43-
4426
# Create a dedicated non-root user for security
45-
RUN addgroup -g 1001 -S appgroup \
46-
&& adduser -u 1001 -S appuser -G appgroup
27+
RUN groupadd --gid 1001 appgroup \
28+
&& useradd --uid 1001 --gid appgroup --system --no-create-home appuser
4729

4830
# Copy only production artifacts from the builder stage
4931
COPY --from=builder /app/node_modules ./node_modules/
@@ -66,4 +48,4 @@ HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
6648
CMD node -e "require('http').get('http://localhost:8080/health', (res) => process.exit(res.statusCode === 200 ? 0 : 1)).on('error', () => process.exit(1))"
6749

6850
# Start the application using npm
69-
ENTRYPOINT ["npm", "start"]
51+
ENTRYPOINT ["npm", "start"]

0 commit comments

Comments
 (0)