Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
node_modules
dist
.env
.env.local
.git
.github
*.log
npm-debug.log*
5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
dist/
node_modules/
coverage/
.turbo/
package-lock.json
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"semi": true,
"singleQuote": true,
"trailingComma": "all",
"printWidth": 100,
"tabWidth": 2
}
42 changes: 42 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Stage 1: Build
FROM node:22-slim AS builder

WORKDIR /app

# copy package files first to leverage caching
COPY package*.json ./

RUN npm install

# grab the rest of the source
COPY . .

# build the project (gets us the dist folder)
RUN npm run build

# Stage 2: Production Runtime
FROM node:22-slim

# curl is useful for the healthcheck probe
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*

WORKDIR /app

# standard production setup
ENV NODE_ENV=production
ENV PORT=3000

# only need the build artifacts and prod deps
COPY --from=builder /app/package*.json ./
COPY --from=builder /app/dist ./dist

# skip the dev dependencies to keep image size down
RUN npm install --omit=dev

# healthcheck to make sure the app is responding
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD curl -f http://localhost:3000/healthz || exit 1

EXPOSE 3000

CMD ["node", "dist/index.js"]
43 changes: 43 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
services:
moltclaw:
build: .
container_name: moltclaw-gateway
restart: always
ports:
- "3000:3000"
environment:
- NODE_ENV=production
- PORT=3000
- DATABASE_URL=postgres://user:pass@db:5432/moltclaw
depends_on:
db:
condition: service_healthy
networks:
- moltclaw-network

db:
image: postgres:16-alpine
container_name: moltclaw-db
restart: always
environment:
- POSTGRES_USER=user
- POSTGRES_PASSWORD=pass
- POSTGRES_DB=moltclaw
ports:
- "5432:5432"
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U user -d moltclaw" ]
interval: 10s
timeout: 5s
retries: 5
networks:
- moltclaw-network

networks:
moltclaw-network:
driver: bridge

volumes:
pgdata:
17 changes: 17 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import js from "@eslint/js";
import ts from "typescript-eslint";

export default ts.config(
js.configs.recommended,
...ts.configs.recommended,
{
rules: {
"no-unused-vars": "warn",
"@typescript-eslint/no-unused-vars": ["warn", { "argsIgnorePattern": "^_" }],
"@typescript-eslint/no-explicit-any": "warn",
},
},
{
ignores: ["dist/", "node_modules/", "coverage/"],
}
);
Loading