build: dockerize repo

Co-authored-by: Ona <no-reply@ona.com>
This commit is contained in:
2025-10-25 01:21:49 +00:00
parent 6c3701ad32
commit 5640ffa990
3 changed files with 112 additions and 0 deletions

46
.dockerignore Normal file
View File

@@ -0,0 +1,46 @@
# Dependencies
node_modules
npm-debug.log
yarn-error.log
bun.lock
# Build outputs
dist
.turbo
# Development files
.git
.gitignore
.gitattributes
.devcontainer
.vscode
# Environment files
.env
.env.local
.env.*.local
*.p8
# OS files
.DS_Store
Thumbs.db
# Logs
*.log
logs
# Testing
coverage
.nyc_output
# Documentation
README.md
*.md
# CI/CD
.github
.gitlab-ci.yml
# Misc
.editorconfig
core.*

43
Dockerfile Normal file
View File

@@ -0,0 +1,43 @@
# syntax=docker/dockerfile:1
# Base stage with Bun
FROM oven/bun:1.3.1-alpine AS base
WORKDIR /app
# Install dependencies stage
FROM base AS deps
COPY package.json bun.lock ./
COPY apps/backend/package.json ./apps/backend/
COPY apps/dashboard/package.json ./apps/dashboard/
RUN bun install --frozen-lockfile
# Build dashboard stage
FROM base AS dashboard-builder
COPY --from=deps /app/node_modules ./node_modules
COPY --from=deps /app/apps/dashboard/node_modules ./apps/dashboard/node_modules
COPY apps/dashboard ./apps/dashboard
COPY package.json bun.lock ./
COPY biome.json ./
WORKDIR /app/apps/dashboard
RUN bun run build
# Production stage
FROM base AS production
ENV NODE_ENV=production
# Copy built dashboard
COPY --from=dashboard-builder /app/apps/dashboard/dist /app/apps/dashboard/dist
# Copy backend source (TypeScript runs directly with Bun)
COPY apps/backend/src /app/apps/backend/src
COPY apps/backend/package.json /app/apps/backend/
# Copy backend dependencies
COPY --from=deps /app/node_modules /app/node_modules
COPY --from=deps /app/apps/backend/node_modules /app/apps/backend/node_modules
WORKDIR /app/apps/backend
EXPOSE 8000
CMD ["bun", "run", "src/index.ts"]

23
docker-compose.yml Normal file
View File

@@ -0,0 +1,23 @@
version: '3.8'
services:
eva:
build:
context: .
dockerfile: Dockerfile
image: eva-monorepo:latest
container_name: eva
restart: unless-stopped
ports:
- "8000:8000"
environment:
- NODE_ENV=production
# Uncomment and configure if you need to pass environment variables
# env_file:
# - apps/backend/.env
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/api/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s