Monorepo for wisp.place. A static site hosting service built on top of the AT Protocol.
wisp.place
1.7 kB
60 lines
1# Build stage
2FROM oven/bun:1.3.7-alpine AS build
3
4WORKDIR /app
5
6# Copy workspace configuration
7COPY package.json bunfig.toml tsconfig.json bun.lock* ./
8
9# Copy all workspace package.json files first (for dependency resolution)
10COPY cli ./cli
11COPY packages ./packages
12COPY apps/main-app/package.json ./apps/main-app/package.json
13COPY apps/hosting-service/package.json ./apps/hosting-service/package.json
14COPY apps/firehose-service/package.json ./apps/firehose-service/package.json
15COPY apps/webhook-service/package.json ./apps/webhook-service/package.json
16
17# Install all dependencies (including workspaces)
18RUN bun install --frozen-lockfile
19
20# Copy source files
21COPY apps/main-app ./apps/main-app
22
23# Build frontend (CSS + JS bundles)
24RUN cd apps/main-app && bun run build
25
26# Build compiled server
27RUN bun build \
28 --compile \
29 --target bun \
30 --minify \
31 --outfile server \
32 apps/main-app/src/index.ts
33
34# Remove source files from public that don't need to be served
35RUN find apps/main-app/public -name "*.tsx" -delete && \
36 find apps/main-app/public -name "*.ts" -delete && \
37 rm -rf apps/main-app/public/editor/.claude
38
39# Final stage - slim image with just the compiled binary
40FROM alpine:3.22
41
42RUN apk add --no-cache libstdc++ libgcc ca-certificates
43
44WORKDIR /app
45
46# Copy compiled server (standalone binary - no node_modules needed)
47COPY --from=build /app/server /app/server
48
49# Copy public static assets (source files already stripped in build stage)
50COPY --from=build /app/apps/main-app/public apps/main-app/public
51
52# Copy built frontend assets
53COPY --from=build /app/apps/main-app/dist apps/main-app/dist
54
55ENV NODE_ENV=production
56ENV PORT=8000
57
58EXPOSE 8000
59
60CMD ["./server"]