-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.example
More file actions
54 lines (45 loc) · 1.64 KB
/
Dockerfile.example
File metadata and controls
54 lines (45 loc) · 1.64 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
# Stage 1: Build the Frontend (Next.js)
FROM oven/bun:alpine AS frontend-builder
WORKDIR /app
# Copy Next.js source code
COPY package.json bun.lock* ./
RUN bun install
COPY tsconfig.json postcss.config.mjs next.config.ts next-env.d.ts eslint.config.mjs ./
COPY app/ app/
COPY components/ components/
COPY lib/ lib/
COPY public/ public/
# Build the Next.js production payload directly to bypass cargo
RUN bunx next build
# Stage 2: The Production Runtime Monolith
FROM debian:bookworm-slim
WORKDIR /app
# Update and install dependencies: OpenSSL (for proxy), Curl (for Bun & healthchecks), Bash (for supervisor)
RUN apt-get update && apt-get install -y \
openssl \
ca-certificates \
curl \
unzip \
&& rm -rf /var/lib/apt/lists/*
# Install Bun globally in the debian container
RUN curl -fsSL https://bun.sh/install | bash
ENV PATH="/root/.bun/bin:${PATH}"
# Install Nylon Mesh globally
RUN curl -fsSL https://mesh.nylon.sh/install | bash
ENV PATH="/root/.nylon-mesh/bin:${PATH}"
# Copy the built Next.js application
COPY --from=frontend-builder /app/package.json ./package.json
COPY --from=frontend-builder /app/.next ./.next
COPY --from=frontend-builder /app/node_modules ./node_modules
COPY --from=frontend-builder /app/public ./public
# Copy the Nylon Mesh configuration file
COPY nylon-mesh.yaml ./nylon-mesh.yaml
# Setup the initialization script
COPY entrypoint.sh.example ./entrypoint.sh
RUN chmod +x ./entrypoint.sh
# Expose ports: 3000 (Pingora traffic), 3001 (Next.js traffic - internal only), 6379 (Redis - internal only)
EXPOSE 3000
# Set production environment
ENV NODE_ENV=production
# Run the supervisor script
CMD ["./entrypoint.sh"]