-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (33 loc) · 1.54 KB
/
Copy pathDockerfile
File metadata and controls
40 lines (33 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# syntax=docker/dockerfile:1
# @hasna/logs — ARM64 Bun image for the cloud (PURE REMOTE, Amendment A1) serve.
# The container runs logs-serve in cloud mode: a stateless API in front of the
# shared cloud Postgres with API-key auth. The same image runs the one-shot
# migration task (command override: ["logs","db","migrate"]).
FROM --platform=linux/arm64 oven/bun:1.3.13-slim AS build
WORKDIR /app
ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
COPY package.json bun.lock tsconfig.json tsconfig.build.json ./
COPY src ./src
COPY sdk ./sdk
RUN bun install --frozen-lockfile
# Runtime needs only the bundled JS (dist/*.js); skip .d.ts emission.
RUN bun run build:js
RUN rm -rf node_modules && bun install --production --frozen-lockfile
FROM --platform=linux/arm64 oven/bun:1.3.13-slim AS runtime
ENV NODE_ENV=production \
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 \
HASNA_LOGS_STORAGE_MODE=cloud \
PORT=8080
WORKDIR /app
COPY --from=build /app/package.json ./package.json
COPY --from=build /app/node_modules ./node_modules
COPY --from=build /app/dist ./dist
# CLI shim so `logs …` works (e.g. the migration task: logs db migrate).
RUN printf '#!/bin/sh\nexec bun /app/dist/cli/index.js "$@"\n' > /usr/local/bin/logs \
&& chmod +x /usr/local/bin/logs
# Run as the non-root `bun` user that the oven/bun base image provides.
USER bun
EXPOSE 8080
HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \
CMD bun -e "const r = await fetch('http://127.0.0.1:'+(process.env.PORT||8080)+'/health'); process.exit(r.ok ? 0 : 1)"
CMD ["bun", "dist/server/index.js"]