Files
shumai/Dockerfile
T

53 lines
1.6 KiB
Docker
Raw Normal View History

2026-05-19 16:05:09 +08:00
# Stage 1: Builder
FROM oven/bun:1 AS builder
WORKDIR /app
# Copy package files
COPY package.json bun.lock ./
COPY --parents packages/*/package.json ./
COPY --parents apps/*/package.json ./
2026-05-19 16:05:09 +08:00
# Install dependencies (including devDependencies for build tools)
RUN bun install --frozen-lockfile
2026-06-02 11:10:59 +08:00
RUN ls -la packages/transcode/node_modules
2026-05-19 16:05:09 +08:00
# Copy source code
COPY . .
# Build API and Worker
RUN bun run build.ts
# Stage 2: Runner
FROM oven/bun:1 AS runner
WORKDIR /app
# Install ffmpeg/ffprobe
COPY --from=mwader/static-ffmpeg:8.1 /ffmpeg /usr/local/bin/
COPY --from=mwader/static-ffmpeg:8.1 /ffprobe /usr/local/bin/
# Install system dependencies for sandbox runtime
RUN apt-get update && apt-get install -y ripgrep bubblewrap socat && rm -rf /var/lib/apt/lists/*
2026-05-19 16:05:09 +08:00
# Copy sharp/img from builder (they are native and already installed)
2026-06-02 11:10:59 +08:00
# COPY --from=builder /app/packages/transcode/node_modules/sharp ./node_modules/sharp
# COPY --from=builder /app/packages/transcode/node_modules/@img ./node_modules/@img
2026-05-19 16:05:09 +08:00
# Manually install temporalio packages and prisma
# These need native bindings or CLI access in the runner environment
RUN bun add @temporalio/activity @temporalio/client @temporalio/worker @temporalio/workflow && \
2026-06-02 11:10:59 +08:00
bun add --dev --omit peer prisma sharp
2026-05-19 16:05:09 +08:00
# Copy build artifacts and prisma config
COPY --from=builder /app/dist ./
COPY --from=builder /app/packages/db/prisma ./packages/db/prisma
2026-05-19 16:05:09 +08:00
COPY --from=builder /app/prisma.config.ts.prod ./prisma.config.ts
# Expose port (Bun Hono defaults to 3000)
EXPOSE 3000
# Default command: run migrations and start API server
CMD ["sh", "-c", "bun prisma migrate deploy && bun apps/web/src/index.js"]