tangled
alpha
login
or
join now
aottr.dev
/
wisp.place-monorepo
forked from
nekomimi.pet/wisp.place-monorepo
0
fork
atom
Monorepo for wisp.place. A static site hosting service built on top of the AT Protocol.
0
fork
atom
overview
issues
pulls
pipelines
dockerfile
nekomimi.pet
1 month ago
35d6511a
e97383c5
+55
-49
1 changed file
expand all
collapse all
unified
split
Dockerfile
+55
-49
Dockerfile
···
1
1
-
# Production stage
2
2
-
FROM oven/bun:1 AS build
1
1
+
# Build stage
2
2
+
FROM oven/bun:1.3 AS build
3
3
4
4
WORKDIR /app
5
5
6
6
# Copy workspace configuration
7
7
-
COPY package.json package.json
8
8
-
COPY bun.lock bun.lock
9
9
-
COPY bunfig.toml bunfig.toml
10
10
-
COPY tsconfig.json tsconfig.json
7
7
+
COPY package.json bunfig.toml tsconfig.json bun.lock* ./
11
8
12
9
# Copy all workspace package.json files first (for dependency resolution)
13
13
-
COPY packages/@wisp/atproto-utils/package.json ./packages/@wisp/atproto-utils/package.json
14
14
-
COPY packages/@wisp/constants/package.json ./packages/@wisp/constants/package.json
15
15
-
COPY packages/@wisp/database/package.json ./packages/@wisp/database/package.json
16
16
-
COPY packages/@wisp/fs-utils/package.json ./packages/@wisp/fs-utils/package.json
17
17
-
COPY packages/@wisp/lexicons/package.json ./packages/@wisp/lexicons/package.json
18
18
-
COPY packages/@wisp/observability/package.json ./packages/@wisp/observability/package.json
19
19
-
COPY packages/@wisp/safe-fetch/package.json ./packages/@wisp/safe-fetch/package.json
10
10
+
COPY cli ./cli
11
11
+
COPY packages ./packages
20
12
COPY apps/main-app/package.json ./apps/main-app/package.json
21
13
COPY apps/hosting-service/package.json ./apps/hosting-service/package.json
22
14
23
23
-
# Install dependencies
24
24
-
RUN bun install
15
15
+
# Install all dependencies (including workspaces)
16
16
+
RUN bun install --frozen-lockfile
25
17
26
26
-
# Copy workspace source files
27
27
-
COPY packages ./packages
18
18
+
# Copy source files
28
19
COPY apps/main-app ./apps/main-app
29
20
30
30
-
ENV NODE_ENV=production
21
21
+
# Build compiled server
22
22
+
RUN bun build \
23
23
+
--compile \
24
24
+
--target bun \
25
25
+
--minify \
26
26
+
--outfile server \
27
27
+
apps/main-app/src/index.ts
31
28
32
32
-
# Build Tailwind CSS (build to temp files then replace originals)
33
33
-
RUN bunx @tailwindcss/cli -i ./apps/main-app/public/styles/global.css -o ./apps/main-app/public/styles/global.tmp.css --minify && \
34
34
-
mv ./apps/main-app/public/styles/global.tmp.css ./apps/main-app/public/styles/global.css
35
35
-
RUN bunx @tailwindcss/cli -i ./apps/main-app/public/admin/styles.css -o ./apps/main-app/public/admin/styles.tmp.css --minify && \
36
36
-
mv ./apps/main-app/public/admin/styles.tmp.css ./apps/main-app/public/admin/styles.css
29
29
+
# Production dependencies stage
30
30
+
FROM oven/bun:1.3 AS prod-deps
37
31
38
38
-
# Build frontend (transpile all .tsx entry points to .js)
39
39
-
RUN bun build ./apps/main-app/public/index.tsx --outdir ./apps/main-app/public --target browser
40
40
-
RUN bun build ./apps/main-app/public/admin/admin.tsx --outdir ./apps/main-app/public/admin --target browser
41
41
-
RUN bun build ./apps/main-app/public/acceptable-use/acceptable-use.tsx --outdir ./apps/main-app/public/acceptable-use --target browser
42
42
-
RUN bun build ./apps/main-app/public/editor/editor.tsx --outdir ./apps/main-app/public/editor --target browser
43
43
-
RUN bun build ./apps/main-app/public/onboarding/onboarding.tsx --outdir ./apps/main-app/public/onboarding --target browser
32
32
+
WORKDIR /app
44
33
45
45
-
# Update HTML files to reference .js instead of .tsx
46
46
-
RUN sed -i 's/\.tsx"/.js"/g' ./apps/main-app/public/index.html
47
47
-
RUN sed -i 's/\.tsx"/.js"/g' ./apps/main-app/public/admin/index.html
48
48
-
RUN sed -i 's/\.tsx"/.js"/g' ./apps/main-app/public/acceptable-use/index.html
49
49
-
RUN sed -i 's/\.tsx"/.js"/g' ./apps/main-app/public/editor/index.html
50
50
-
RUN sed -i 's/\.tsx"/.js"/g' ./apps/main-app/public/onboarding/index.html
34
34
+
COPY package.json bunfig.toml tsconfig.json bun.lock* ./
35
35
+
COPY packages ./packages
36
36
+
COPY apps/main-app/package.json ./apps/main-app/package.json
37
37
+
COPY apps/hosting-service/package.json ./apps/hosting-service/package.json
38
38
+
COPY cli/ ./cli
51
39
52
52
-
# Build backend as compiled binary
53
53
-
RUN bun build \
54
54
-
--compile \
55
55
-
--target=bun \
56
56
-
--minify-whitespace \
57
57
-
--minify-syntax \
58
58
-
--outfile server \
59
59
-
./apps/main-app/src/index.ts
40
40
+
# Install only production dependencies
41
41
+
RUN bun install --frozen-lockfile --production
42
42
+
43
43
+
# Remove unnecessary large packages (bun is already in base image, these are dev tools)
44
44
+
RUN rm -rf /app/node_modules/bun \
45
45
+
/app/node_modules/@oven \
46
46
+
/app/node_modules/prettier \
47
47
+
/app/node_modules/@ts-morph
60
48
61
61
-
FROM gcr.io/distroless/base
49
49
+
# Final stage - use distroless or slim debian-based image
50
50
+
FROM debian:bookworm-slim
51
51
+
52
52
+
# Install Bun runtime
53
53
+
COPY --from=oven/bun:1.3 /usr/local/bin/bun /usr/local/bin/bun
62
54
63
55
WORKDIR /app
64
56
65
65
-
COPY --from=build /app/server server
66
66
-
COPY --from=build /app/apps/main-app/public /app/apps/main-app/public
57
57
+
# Copy compiled server
58
58
+
COPY --from=build /app/server /app/server
67
59
68
68
-
ENV NODE_ENV=production
60
60
+
# Copy public files
61
61
+
COPY apps/main-app/public apps/main-app/public
69
62
70
70
-
CMD ["./server"]
63
63
+
# Copy production dependencies only
64
64
+
COPY --from=prod-deps /app/node_modules /app/node_modules
71
65
72
72
-
EXPOSE 8000
66
66
+
# Copy configs
67
67
+
COPY package.json bunfig.toml tsconfig.json /app/
68
68
+
COPY apps/main-app/tsconfig.json /app/apps/main-app/tsconfig.json
69
69
+
COPY apps/main-app/package.json /app/apps/main-app/package.json
70
70
+
71
71
+
# Create symlink for module resolution
72
72
+
RUN ln -s /app/node_modules /app/apps/main-app/node_modules
73
73
+
74
74
+
ENV PORT=8000
75
75
+
76
76
+
EXPOSE 8000
77
77
+
78
78
+
CMD ["./server"]