mirror of
https://github.com/mendableai/firecrawl.git
synced 2024-11-16 11:42:24 +08:00
42 lines
1.5 KiB
Docker
42 lines
1.5 KiB
Docker
FROM node:20-slim AS base
|
|
ENV PNPM_HOME="/pnpm"
|
|
ENV PATH="$PNPM_HOME:$PATH"
|
|
LABEL fly_launch_runtime="Node.js"
|
|
RUN corepack enable
|
|
COPY . /app
|
|
WORKDIR /app
|
|
|
|
FROM base AS prod-deps
|
|
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile
|
|
|
|
FROM base AS build
|
|
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
|
|
|
|
RUN apt-get update -qq && apt-get install -y ca-certificates && update-ca-certificates
|
|
RUN pnpm install
|
|
RUN --mount=type=secret,id=SENTRY_AUTH_TOKEN \
|
|
bash -c 'export SENTRY_AUTH_TOKEN="$(cat /run/secrets/SENTRY_AUTH_TOKEN)"; if [ -z $SENTRY_AUTH_TOKEN ]; then pnpm run build:nosentry; else pnpm run build; fi'
|
|
|
|
# Install Go
|
|
FROM golang:1.19 AS go-base
|
|
COPY src/lib/go-html-to-md /app/src/lib/go-html-to-md
|
|
|
|
# Install Go dependencies and build parser lib
|
|
RUN cd /app/src/lib/go-html-to-md && \
|
|
go mod tidy && \
|
|
go build -o html-to-markdown.so -buildmode=c-shared html-to-markdown.go && \
|
|
chmod +x html-to-markdown.so
|
|
|
|
FROM base
|
|
RUN apt-get update -qq && \
|
|
apt-get install --no-install-recommends -y chromium chromium-sandbox && \
|
|
rm -rf /var/lib/apt/lists /var/cache/apt/archives
|
|
COPY --from=prod-deps /app/node_modules /app/node_modules
|
|
COPY --from=build /app /app
|
|
COPY --from=go-base /app/src/lib/go-html-to-md/html-to-markdown.so /app/dist/src/lib/go-html-to-md/html-to-markdown.so
|
|
|
|
# Start the server by default, this can be overwritten at runtime
|
|
EXPOSE 8080
|
|
ENV PUPPETEER_EXECUTABLE_PATH="/usr/bin/chromium"
|
|
|
|
ENTRYPOINT "/app/docker-entrypoint.sh" |