Nikolai X. Shadeuxs
c8edef5853
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 26s
31 lines
925 B
Docker
31 lines
925 B
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
|
|
WORKDIR /app
|
|
|
|
# Copy only the package files first
|
|
COPY package.json pnpm-lock.yaml ./
|
|
|
|
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
|
|
COPY . .
|
|
RUN pnpm run build
|
|
|
|
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
|
|
|
|
# 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"]
|