feat(ci): socket realtime image for hosting (#565)

* feat: socket server for self/local deployment

* ci: memory limit and redundant dependency install

* chore: update readme, devcontainer, cli package

* chore: add new dev scripts and update README for full development setup
This commit is contained in:
Aditya Tripathi
2025-06-27 21:33:29 +05:30
committed by GitHub
parent 0049644224
commit 00334e501f
10 changed files with 187 additions and 4 deletions

View File

@@ -0,0 +1,51 @@
# ========================================
# Base Stage: Alpine Linux with Bun
# ========================================
FROM oven/bun:alpine AS base
# ========================================
# Dependencies Stage: Install Dependencies
# ========================================
FROM base AS deps
RUN apk add --no-cache libc6-compat
WORKDIR /app
# Install turbo globally
RUN bun install -g turbo
COPY package.json bun.lock ./
RUN mkdir -p apps
COPY apps/sim/package.json ./apps/sim/package.json
RUN bun install --omit dev --ignore-scripts
# ========================================
# Builder Stage: Build the Application
# ========================================
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
# ========================================
# Runner Stage: Run the Socket Server
# ========================================
FROM base AS runner
WORKDIR /app
ENV NODE_ENV=production
# Copy the entire sim app since socket-server has dependencies on other modules
COPY --from=builder /app/apps/sim ./apps/sim
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./package.json
# Expose socket server port (default 3002, but configurable via PORT env var)
EXPOSE 3002
ENV PORT=3002 \
SOCKET_PORT=3002 \
HOSTNAME="0.0.0.0"
# Run the socket server directly
CMD ["bun", "apps/sim/socket-server/index.ts"]