Monorepo for wisp.place. A static site hosting service built on top of the AT Protocol.

eh

+55 -10
+47 -8
Dockerfile
··· 1 1 # Production stage 2 - FROM oven/bun:1.3 2 + FROM oven/bun:1 AS build 3 3 4 4 WORKDIR /app 5 5 6 6 # Copy workspace configuration 7 - COPY package.json bunfig.toml tsconfig.json bun.lock* ./ 7 + COPY package.json package.json 8 + COPY bun.lock bun.lock 9 + COPY bunfig.toml bunfig.toml 10 + COPY tsconfig.json tsconfig.json 8 11 9 12 # Copy all workspace package.json files first (for dependency resolution) 10 13 COPY packages/@wisp/atproto-utils/package.json ./packages/@wisp/atproto-utils/package.json ··· 18 21 COPY apps/hosting-service/package.json ./apps/hosting-service/package.json 19 22 20 23 # Install dependencies 21 - RUN bun install --frozen-lockfile --production 24 + RUN bun install 22 25 23 26 # Copy workspace source files 24 27 COPY packages ./packages 28 + COPY apps/main-app ./apps/main-app 25 29 26 - # Copy app source and public files 27 - COPY apps/main-app ./apps/main-app 30 + ENV NODE_ENV=production 31 + 32 + # Build Tailwind CSS (build to temp files then replace originals) 33 + RUN bunx @tailwindcss/cli -i ./apps/main-app/public/styles/global.css -o ./apps/main-app/public/styles/global.tmp.css --minify && \ 34 + mv ./apps/main-app/public/styles/global.tmp.css ./apps/main-app/public/styles/global.css 35 + RUN bunx @tailwindcss/cli -i ./apps/main-app/public/admin/styles.css -o ./apps/main-app/public/admin/styles.tmp.css --minify && \ 36 + mv ./apps/main-app/public/admin/styles.tmp.css ./apps/main-app/public/admin/styles.css 37 + 38 + # Build frontend (transpile all .tsx entry points to .js) 39 + RUN bun build ./apps/main-app/public/index.tsx --outdir ./apps/main-app/public --target browser 40 + RUN bun build ./apps/main-app/public/admin/admin.tsx --outdir ./apps/main-app/public/admin --target browser 41 + RUN bun build ./apps/main-app/public/acceptable-use/acceptable-use.tsx --outdir ./apps/main-app/public/acceptable-use --target browser 42 + RUN bun build ./apps/main-app/public/editor/editor.tsx --outdir ./apps/main-app/public/editor --target browser 43 + RUN bun build ./apps/main-app/public/onboarding/onboarding.tsx --outdir ./apps/main-app/public/onboarding --target browser 44 + 45 + # Update HTML files to reference .js instead of .tsx 46 + RUN sed -i 's/\.tsx"/.js"/g' ./apps/main-app/public/index.html 47 + RUN sed -i 's/\.tsx"/.js"/g' ./apps/main-app/public/admin/index.html 48 + RUN sed -i 's/\.tsx"/.js"/g' ./apps/main-app/public/acceptable-use/index.html 49 + RUN sed -i 's/\.tsx"/.js"/g' ./apps/main-app/public/editor/index.html 50 + RUN sed -i 's/\.tsx"/.js"/g' ./apps/main-app/public/onboarding/index.html 51 + 52 + # Build backend as compiled binary 53 + RUN bun build \ 54 + --compile \ 55 + --target=bun \ 56 + --minify-whitespace \ 57 + --minify-syntax \ 58 + --outfile server \ 59 + ./apps/main-app/src/index.ts 60 + 61 + FROM gcr.io/distroless/base 62 + 63 + WORKDIR /app 64 + 65 + COPY --from=build /app/server server 66 + COPY --from=build /app/apps/main-app/public /app/apps/main-app/public 28 67 29 - ENV PORT=8000 68 + ENV NODE_ENV=production 30 69 31 - EXPOSE 8000 70 + CMD ["./server"] 32 71 33 - CMD ["bun", "run", "apps/main-app/src/index.ts"] 72 + EXPOSE 8000
+8 -2
apps/main-app/src/index.ts
··· 1 + // Fix for Elysia issue with Bun, (see https://github.com/oven-sh/bun/issues/12161) 2 + process.getBuiltinModule = require; 3 + 1 4 import { Elysia } from 'elysia' 2 5 import type { Context } from 'elysia' 3 6 import { cors } from '@elysiajs/cors' ··· 127 130 .use( 128 131 await staticPlugin({ 129 132 assets: './apps/main-app/public', 130 - prefix: '/', 133 + prefix: '/' 131 134 }) 132 135 ) 133 136 .get('/client-metadata.json', () => { ··· 200 203 exposeHeaders: ['Content-Type'], 201 204 maxAge: 86400 // 24 hours 202 205 })) 203 - .listen(8000) 206 + .listen({ 207 + port: 8000, 208 + hostname: '0.0.0.0' 209 + }) 204 210 205 211 console.log( 206 212 `🦊 Elysia is running at ${app.server?.hostname}:${app.server?.port}`