mirror of
https://github.com/memohai/Memoh.git
synced 2026-04-25 07:00:48 +09:00
38afb2e1c6
Replace the single browser image (which required local build) with three prebuilt images: browser-chromium, browser-firefox, and browser (both). Each is exposed as a separate Docker Compose profile so users can simply `docker compose --profile browser-chromium up -d` without any local build step, significantly reducing install time.
42 lines
1.2 KiB
Docker
42 lines
1.2 KiB
Docker
# syntax=docker/dockerfile:1
|
|
FROM --platform=$BUILDPLATFORM oven/bun:1 AS builder
|
|
|
|
WORKDIR /build
|
|
|
|
COPY apps/browser/package.json apps/browser/bun.lock* ./apps/browser/
|
|
COPY packages/config/package.json ./packages/config/package.json
|
|
|
|
RUN echo '{"name":"@memohai/monorepo","private":true,"workspaces":["apps/*","packages/*"]}' > package.json
|
|
|
|
RUN cd apps/browser && bun install
|
|
|
|
COPY packages/config/ ./packages/config/
|
|
COPY apps/browser/ ./apps/browser/
|
|
|
|
RUN cd apps/browser && bun run build
|
|
|
|
FROM ubuntu:noble
|
|
|
|
ENV BROWSER_CORES=firefox
|
|
|
|
WORKDIR /app
|
|
|
|
RUN apt-get update && apt-get install -y unzip curl && \
|
|
curl -fsSL https://bun.sh/install | bash && \
|
|
ln -s /root/.bun/bin/bun /usr/local/bin/bun && \
|
|
apt-get clean && rm -rf /var/lib/apt/lists/*
|
|
|
|
COPY --from=builder /build/apps/browser/dist /app/dist
|
|
COPY --from=builder /build/apps/browser/node_modules /app/node_modules
|
|
COPY --from=builder /build/apps/browser/package.json /app/package.json
|
|
COPY --from=builder /build/node_modules /node_modules
|
|
|
|
RUN bun /app/node_modules/.bin/playwright install --with-deps firefox
|
|
|
|
EXPOSE 8083
|
|
|
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \
|
|
CMD curl -sf http://127.0.0.1:8083/health || exit 1
|
|
|
|
CMD ["bun", "run", "dist/index.js"]
|