diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..510064d --- /dev/null +++ b/.dockerignore @@ -0,0 +1,16 @@ +node_modules +npm-debug.log +.nyc_output +coverage +.git +.gitignore +README.md +.env +.env.local +.env.development.local +.env.test.local +.env.production.local +.DS_Store +Dockerfile +.dockerignore +docker-compose*.yml \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e56a525 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,30 @@ +# Base build stage +FROM node:22-alpine AS builder + +WORKDIR /app + +# Install dependencies +COPY package*.json ./ +RUN npm install --only=production + +# Copy source +COPY . . + +# Runtime stage +FROM node:22-alpine + +WORKDIR /app + +# Copy only built output + dependencies +COPY --from=builder /app /app + +# Run as non-root user for security +RUN addgroup -S appgroup && adduser -S appuser -G appgroup +USER appuser + +EXPOSE 3000 + +# Run in production mode +ENV NODE_ENV=production + +CMD ["npm", "run", "start"] diff --git a/README.md b/README.md index 2cd120f..b9bb364 100644 --- a/README.md +++ b/README.md @@ -99,6 +99,28 @@ npm run dev --- +## Running with Docker + +Run Eremos inside Docker, without installing Node.js locally. + +Build the image: + +```bash +docker build -t eremos-core . +``` + +Run the container: + +```bash +docker run --rm -it -p 3000:3000 eremos-core +``` + +Using Docker Compose: + +```bash +docker compose up +``` + ## Key Folders - `/agents` - Agent templates + logic diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..bfc2b91 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,18 @@ +version: "3.9" + +services: + eremos-core: + build: + context: . + dockerfile: Dockerfile + container_name: eremos-core + restart: unless-stopped # auto-restart if crash or system reboot + ports: + - "3000:3000" # host:container + env_file: + - .env.local # keep secrets outside the compose file + environment: + NODE_ENV: production + volumes: + - /app/node_modules # avoid mounting host node_modules + command: npm run start # run optimized build, not dev server