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
|
2024-06-19 04:15:45 -04:00
|
|
|
COPY . /app
|
2024-04-15 17:01:47 -04:00
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
FROM base AS prod-deps
|
2024-06-19 04:15:45 -04:00
|
|
|
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile
|
2024-04-15 17:01:47 -04:00
|
|
|
|
|
|
|
FROM base AS build
|
2024-06-19 04:15:45 -04:00
|
|
|
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
|
|
|
|
|
|
|
|
RUN pnpm install
|
|
|
|
RUN pnpm run build
|
2024-04-15 17:01:47 -04:00
|
|
|
|
|
|
|
# Install packages needed for deployment
|
2024-06-19 04:15:45 -04:00
|
|
|
|
|
|
|
|
2024-04-15 17:01:47 -04:00
|
|
|
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
|
|
|
|
|
2024-06-19 04:15:45 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
2024-04-15 17:01:47 -04:00
|
|
|
# Start the server by default, this can be overwritten at runtime
|
|
|
|
EXPOSE 8080
|
|
|
|
ENV PUPPETEER_EXECUTABLE_PATH="/usr/bin/chromium"
|
|
|
|
CMD [ "pnpm", "run", "start:production" ]
|
|
|
|
CMD [ "pnpm", "run", "worker:production" ]
|