62 lines
2.0 KiB
Docker
62 lines
2.0 KiB
Docker
# Build context: monorepo root (run: docker build -f labelapp/Dockerfile .)
|
|
FROM oven/bun:1 AS base
|
|
|
|
# -- Install dependencies --
|
|
FROM base AS deps
|
|
WORKDIR /app
|
|
COPY package.json bun.lock ./
|
|
COPY packages/schemas/package.json packages/schemas/
|
|
COPY ts/package.json ts/
|
|
COPY labelapp/package.json labelapp/
|
|
RUN bun install --frozen-lockfile
|
|
|
|
# -- Build Next.js --
|
|
FROM base AS builder
|
|
WORKDIR /app
|
|
COPY --from=deps /app/node_modules ./node_modules
|
|
COPY --from=deps /app/packages/schemas/node_modules ./packages/schemas/node_modules
|
|
COPY --from=deps /app/labelapp/node_modules ./labelapp/node_modules
|
|
COPY package.json bun.lock ./
|
|
COPY packages/schemas/ packages/schemas/
|
|
COPY labelapp/ labelapp/
|
|
ENV NEXT_TELEMETRY_DISABLED=1
|
|
RUN cd labelapp && bun run build
|
|
|
|
# -- Production image --
|
|
FROM base AS runner
|
|
WORKDIR /app
|
|
ENV NODE_ENV=production
|
|
ENV NEXT_TELEMETRY_DISABLED=1
|
|
|
|
# Standalone server + static assets
|
|
COPY --from=builder /app/labelapp/.next/standalone ./
|
|
COPY --from=builder /app/labelapp/.next/static ./labelapp/.next/static
|
|
COPY --from=builder /app/labelapp/public ./labelapp/public
|
|
|
|
# Drizzle migration tooling
|
|
COPY --from=deps /app/node_modules ./node_modules
|
|
COPY --from=deps /app/labelapp/node_modules ./labelapp/node_modules
|
|
COPY --from=builder /app/labelapp/drizzle.config.ts ./labelapp/
|
|
COPY --from=builder /app/labelapp/drizzle/ ./labelapp/drizzle/
|
|
COPY --from=builder /app/labelapp/db/ ./labelapp/db/
|
|
COPY --from=builder /app/packages/schemas/ ./packages/schemas/
|
|
COPY --from=builder /app/package.json ./
|
|
|
|
# Seed/sample/assign scripts
|
|
COPY --from=builder /app/labelapp/scripts/ ./labelapp/scripts/
|
|
COPY --from=builder /app/labelapp/lib/ ./labelapp/lib/
|
|
|
|
# Seed data (paragraphs + stage1 annotations)
|
|
COPY data/paragraphs/paragraphs-clean.jsonl /app/data/paragraphs-clean.jsonl
|
|
COPY data/annotations/stage1.jsonl /app/data/stage1.jsonl
|
|
|
|
# Entrypoint
|
|
COPY labelapp/entrypoint.sh /app/entrypoint.sh
|
|
RUN chmod +x /app/entrypoint.sh
|
|
|
|
EXPOSE 3000
|
|
ENV PORT=3000
|
|
ENV HOSTNAME=0.0.0.0
|
|
|
|
ENTRYPOINT ["/app/entrypoint.sh"]
|