Files
firecrawl/apps/api/Dockerfile
T

51 lines
1.6 KiB
Docker
Raw Normal View History

2025-02-21 17:44:01 +01:00
FROM node:22-slim AS base
2025-02-05 03:19:11 -06:00
2024-04-15 17:01:47 -04:00
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
2024-04-15 17:01:47 -04:00
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
2025-02-21 17:44:01 +01:00
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install && pnpm run build
2024-04-15 17:01:47 -04:00
# Install Go
2025-02-21 17:44:01 +01:00
FROM golang:1.24 AS go-base
2024-10-31 17:52:38 +02:00
COPY sharedLibs/go-html-to-md /app/sharedLibs/go-html-to-md
2024-04-15 17:01:47 -04:00
# Install Go dependencies and build parser lib
2024-10-31 17:52:38 +02:00
RUN cd /app/sharedLibs/go-html-to-md && \
2024-09-03 10:56:07 -03:00
go mod tidy && \
go build -o html-to-markdown.so -buildmode=c-shared html-to-markdown.go && \
chmod +x html-to-markdown.so
2024-04-15 17:01:47 -04:00
2025-01-24 22:04:54 +01:00
# Install Rust
2025-02-21 17:44:01 +01:00
FROM rust:1-slim AS rust-base
2025-01-24 22:04:54 +01:00
COPY sharedLibs/html-transformer /app/sharedLibs/html-transformer
2025-02-21 17:44:01 +01:00
# Install Rust dependencies and build transformer lib
2025-01-24 22:04:54 +01:00
RUN cd /app/sharedLibs/html-transformer && \
cargo build --release && \
chmod +x target/release/libhtml_transformer.so
2024-04-15 17:01:47 -04:00
FROM base
2025-02-21 17:44:01 +01:00
COPY --from=build /app/dist /app/dist
2024-04-15 17:01:47 -04:00
COPY --from=prod-deps /app/node_modules /app/node_modules
2024-10-31 18:14:20 +02:00
COPY --from=go-base /app/sharedLibs/go-html-to-md/html-to-markdown.so /app/sharedLibs/go-html-to-md/html-to-markdown.so
2025-01-24 22:04:54 +01:00
COPY --from=rust-base /app/sharedLibs/html-transformer/target/release/libhtml_transformer.so /app/sharedLibs/html-transformer/target/release/libhtml_transformer.so
2024-04-15 17:01:47 -04:00
# Install git
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
2024-04-15 17:01:47 -04:00
# Start the server by default, this can be overwritten at runtime
EXPOSE 8080
2024-09-27 20:44:52 +02:00
# Make sure the entrypoint script has the correct line endings
RUN sed -i 's/\r$//' /app/docker-entrypoint.sh
2025-02-05 03:19:11 -06:00
ENTRYPOINT "/app/docker-entrypoint.sh"