+1
-15
Dockerfile
+1
-15
Dockerfile
···
14
14
COPY src ./src
15
15
COPY public ./public
16
16
17
-
# Build the application (if needed)
18
-
RUN bun build \
19
-
--compile \
20
-
--minify \
21
-
--outfile server \
22
-
src/index.ts
23
-
24
-
FROM scratch AS runtime
25
-
WORKDIR /app
26
-
COPY --from=base /app/server /app/server
27
-
28
-
# Set environment variables (can be overridden at runtime)
29
17
ENV PORT=3000
30
18
ENV NODE_ENV=production
31
19
32
-
# Expose the application port
33
20
EXPOSE 3000
34
21
35
-
# Start the application
36
-
CMD ["./server"]
22
+
CMD ["bun", "start"]
+7
-7
hosting-service/Dockerfile
+7
-7
hosting-service/Dockerfile
···
1
-
# Use official Bun image
2
-
FROM oven/bun:1.3 AS base
1
+
# Use official Node.js Alpine image
2
+
FROM node:alpine AS base
3
3
4
4
# Set working directory
5
5
WORKDIR /app
6
6
7
7
# Copy package files
8
-
COPY package.json bun.lock ./
8
+
COPY package.json ./
9
9
10
10
# Install dependencies
11
-
RUN bun install --frozen-lockfile --production
11
+
RUN npm install
12
12
13
13
# Copy source code
14
14
COPY src ./src
···
25
25
26
26
# Health check
27
27
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
28
-
CMD bun -e "fetch('http://localhost:3001/health').then(r => r.ok ? process.exit(0) : process.exit(1)).catch(() => process.exit(1))"
28
+
CMD node -e "fetch('http://localhost:3001/health').then(r => r.ok ? process.exit(0) : process.exit(1)).catch(() => process.exit(1))"
29
29
30
-
# Start the application
31
-
CMD ["bun", "src/index.ts"]
30
+
# Start the application (can override with 'npm run backfill' in compose)
31
+
CMD ["npm", "run", "start"]
+32
hosting-service/docker-entrypoint.sh
+32
hosting-service/docker-entrypoint.sh
···
1
+
#!/bin/sh
2
+
set -e
3
+
4
+
# Run different modes based on MODE environment variable
5
+
# Modes:
6
+
# - server (default): Start the hosting service
7
+
# - backfill: Run cache backfill and exit
8
+
# - backfill-server: Run cache backfill, then start the server
9
+
10
+
MODE="${MODE:-server}"
11
+
12
+
case "$MODE" in
13
+
backfill)
14
+
echo "๐ Running in backfill-only mode..."
15
+
exec npm run backfill
16
+
;;
17
+
backfill-server)
18
+
echo "๐ Running backfill, then starting server..."
19
+
npm run backfill
20
+
echo "โ
Backfill complete, starting server..."
21
+
exec npm run start
22
+
;;
23
+
server)
24
+
echo "๐ Starting server..."
25
+
exec npm run start
26
+
;;
27
+
*)
28
+
echo "โ Unknown MODE: $MODE"
29
+
echo "Valid modes: server, backfill, backfill-server"
30
+
exit 1
31
+
;;
32
+
esac
+2
-2
hosting-service/package.json
+2
-2
hosting-service/package.json
···
5
5
"scripts": {
6
6
"dev": "tsx --env-file=.env watch src/index.ts",
7
7
"build": "tsc",
8
-
"start": "tsx --env-file=.env src/index.ts",
9
-
"backfill": "tsx --env-file=.env src/index.ts --backfill"
8
+
"start": "tsx src/index.ts",
9
+
"backfill": "tsx src/index.ts --backfill"
10
10
},
11
11
"dependencies": {
12
12
"@atproto/api": "^0.17.4",