-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
38 lines (31 loc) · 1.43 KB
/
Dockerfile
File metadata and controls
38 lines (31 loc) · 1.43 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
# syntax=docker/dockerfile:1.4
FROM oven/bun:1.3.5 AS builder
WORKDIR /app
# Copy everything for dependency resolution
COPY . .
# Install with BuildKit cache mount for faster rebuilds
RUN --mount=type=cache,target=/root/.bun/install/cache \
bun install
# Build-time env vars needed for Next.js page collection (overridden at runtime)
ENV BETTER_AUTH_URL=http://localhost:3000
ENV BETTER_AUTH_SECRET=build-time-placeholder
# Create placeholder .env.local (symlink target excluded in build context)
RUN touch apps/console/.env.local apps/observatory/.env.local
RUN bun run build --filter=console...
FROM oven/bun:1.3.5-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production
RUN addgroup -S engram && adduser -S engram -G engram
# Copy workspace dependencies
COPY --from=builder --chown=engram:engram /app/node_modules ./node_modules
COPY --from=builder --chown=engram:engram /app/package.json ./package.json
COPY --from=builder --chown=engram:engram /app/packages ./packages
# Next.js build output
COPY --from=builder --chown=engram:engram /app/apps/console/.next ./apps/console/.next
COPY --from=builder --chown=engram:engram /app/apps/console/public ./apps/console/public
COPY --from=builder --chown=engram:engram /app/apps/console/package.json ./apps/console/
COPY --from=builder --chown=engram:engram /app/apps/console/next.config.ts ./apps/console/
USER engram
EXPOSE 3000
WORKDIR /app/apps/console
CMD ["bun", "run", "next", "start", "--port", "3000"]