2024-04-15 17:01:47 -04:00
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
2024-08-21 19:08:03 +02:00
RUN apt-get update -qq && apt-get install -y ca-certificates && update-ca-certificates
2024-04-15 17:01:47 -04:00
RUN pnpm install
2024-08-21 19:08:03 +02:00
RUN --mount= type = secret,id= SENTRY_AUTH_TOKEN \
2024-08-21 20:40:42 +02:00
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'
2024-04-15 17:01:47 -04:00
2024-09-03 14:08:07 -03:00
# Install Go
2024-09-03 10:56:07 -03:00
FROM golang:1.19 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
2024-09-03 14:08:07 -03: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
FROM base
COPY --from= prod-deps /app/node_modules /app/node_modules
COPY --from= build /app /app
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
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
ENV PUPPETEER_EXECUTABLE_PATH = "/usr/bin/chromium"
2024-10-09 18:46:26 +00:00
# Make sure the entrypoint script has the correct line endings
RUN sed -i 's/\r$//' /app/docker-entrypoint.sh
2024-09-27 22:16:27 +02:00
ENTRYPOINT "/app/docker-entrypoint.sh"