0

Update apps/api/Dockerfile
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 5m11s

This commit is contained in:
Nikolai X. Shadeuxs 2024-06-19 04:36:10 -04:00
parent 6e8c2f2f1b
commit 073e439cda

View File

@ -3,30 +3,33 @@ ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH" ENV PATH="$PNPM_HOME:$PATH"
LABEL fly_launch_runtime="Node.js" LABEL fly_launch_runtime="Node.js"
RUN corepack enable RUN corepack enable
COPY . /app
WORKDIR /app WORKDIR /app
# Copy only the package files first
COPY apps/api/package.json apps/api/pnpm-lock.yaml ./
FROM base AS prod-deps FROM base AS prod-deps
RUN pnpm install --prod --frozen-lockfile RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile
FROM base AS build FROM base AS build
COPY apps/api/package.json apps/api/pnpm-lock.yaml ./ RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
RUN pnpm install --frozen-lockfile
COPY apps/api . RUN pnpm install
RUN pnpm run build RUN pnpm run build
FROM node:20-slim # Install packages needed for deployment
WORKDIR /app
FROM base
RUN apt-get update -qq && \ RUN apt-get update -qq && \
apt-get install --no-install-recommends -y chromium chromium-sandbox && \ apt-get install --no-install-recommends -y chromium chromium-sandbox && \
rm -rf /var/lib/apt/lists /var/cache/apt/archives rm -rf /var/lib/apt/lists /var/cache/apt/archives
COPY --from=prod-deps /app/node_modules /app/node_modules COPY --from=prod-deps /app/node_modules /app/node_modules
COPY --from=build /app /app COPY --from=build /app /app
# Start the server by default, this can be overwritten at runtime # Start the server by default, this can be overwritten at runtime
EXPOSE 8080 EXPOSE 8080
ENV PUPPETEER_EXECUTABLE_PATH="/usr/bin/chromium" ENV PUPPETEER_EXECUTABLE_PATH="/usr/bin/chromium"
CMD ["pnpm", "run", "start:production"] CMD [ "pnpm", "run", "start:production" ]
CMD ["pnpm", "run", "worker:production"] CMD [ "pnpm", "run", "worker:production" ]