forked from caffo/SMRY
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
64 lines (48 loc) · 1.84 KB
/
Dockerfile
File metadata and controls
64 lines (48 loc) · 1.84 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
FROM node:24-alpine AS base
# Install bun for faster package installation
RUN npm install -g bun
# Install dependencies only
FROM base AS deps
WORKDIR /app
COPY package.json bun.lock ./
# Cache bust: 2026-01-09 - force clean install to remove stale jsdom
RUN bun install --frozen-lockfile
# Build the Next.js application
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
ENV NEXT_TELEMETRY_DISABLED=1
# Set INTERNAL_API_URL for Next.js rewrites (build-time config)
# In production on Railway, this points to the smry-api service
ARG INTERNAL_API_URL=http://smry-api.railway.internal:3001
ENV INTERNAL_API_URL=$INTERNAL_API_URL
# Set NEXT_PUBLIC_API_URL for client-side API calls (build-time config)
# This makes the browser call the API directly, bypassing Next.js rewrites
ARG NEXT_PUBLIC_API_URL=https://api.smry.ai
ENV NEXT_PUBLIC_API_URL=$NEXT_PUBLIC_API_URL
# Public vars (inlined into client bundle)
ARG NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY
ENV NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=$NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY
ARG NEXT_PUBLIC_CLERK_PATRON_PLAN_ID
ENV NEXT_PUBLIC_CLERK_PATRON_PLAN_ID=$NEXT_PUBLIC_CLERK_PATRON_PLAN_ID
ARG NEXT_PUBLIC_URL=https://smry.ai
ENV NEXT_PUBLIC_URL=$NEXT_PUBLIC_URL
RUN bun run build
FROM node:24-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1
# Create non-root user for security
RUN addgroup --system --gid 1001 nodejs && \
adduser --system --uid 1001 nodejs
# Copy Next.js standalone build
COPY --chown=nodejs:nodejs --from=builder /app/public ./public
COPY --chown=nodejs:nodejs --from=builder /app/.next/standalone ./
COPY --chown=nodejs:nodejs --from=builder /app/.next/static ./.next/static
USER nodejs
EXPOSE 3000
ENV PORT=3000
ENV HOSTNAME="0.0.0.0"
# Use Node.js instead of Bun for production to avoid memory leaks
CMD ["node", "server.js"]