From 5640ffa990abea976b6085e0245837c6a5a24665 Mon Sep 17 00:00:00 2001 From: kenneth Date: Sat, 25 Oct 2025 01:21:49 +0000 Subject: [PATCH] build: dockerize repo Co-authored-by: Ona --- .dockerignore | 46 ++++++++++++++++++++++++++++++++++++++++++++++ Dockerfile | 43 +++++++++++++++++++++++++++++++++++++++++++ docker-compose.yml | 23 +++++++++++++++++++++++ 3 files changed, 112 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..53cd07f --- /dev/null +++ b/.dockerignore @@ -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.* diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..26174df --- /dev/null +++ b/Dockerfile @@ -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"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..3c6ce09 --- /dev/null +++ b/docker-compose.yml @@ -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