Skip to content
Merged
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
2 changes: 0 additions & 2 deletions .github/workflows/CI-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ name: Build with Bun

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
build:
Expand Down
25 changes: 25 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Use Bun official image
FROM oven/bun:latest

WORKDIR /app

# Copy root files and install root dependencies
# Copy root and workspace manifests
COPY package.json bun.lock ./
COPY packages/server/package.json ./packages/server/
COPY packages/client/package.json ./packages/client/

# Install dependencies with full workspace context
RUN bun install

# Copy the rest of the monorepo
COPY . .

# Build both packages
RUN bun run build

# Expose ports (adjust as needed)
EXPOSE 3000

# Start both client and server
CMD ["bun", "start.ts"]
32 changes: 32 additions & 0 deletions start.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// start.ts
import { serve } from "bun";
import express from "express";
import dotenv from "dotenv";
import router from "./packages/server/routes"; // adjust path if needed
import path from "path";
import { readFile } from "fs/promises";

dotenv.config();

const app = express();
app.use(express.json());
app.use("/", router); // mount your API routes in the root

const clientDist = path.resolve(import.meta.dir, "packages/client/dist");

// Serve static files
app.use(express.static(clientDist));

// Spa fallback with named fallback
app.get("/*splat", async (_, res) => {
const indexPath = path.join(clientDist, "index.html");
const html = await readFile(indexPath, "utf-8");
res.setHeader("Content-Type", "text/html");
res.send(html);
});

// Start server
const port = process.env.PORT || 3000;
app.listen(port, () => {
console.log(`Unified app running at http://localhost:${port}`);
});