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,28 +3,31 @@ ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
LABEL fly_launch_runtime="Node.js"
RUN corepack enable
COPY . /app
WORKDIR /app
# Copy only the package files first
COPY apps/api/package.json apps/api/pnpm-lock.yaml ./
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
COPY apps/api/package.json apps/api/pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile
COPY apps/api .
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
RUN pnpm install
RUN pnpm run build
FROM node:20-slim
WORKDIR /app
# Install packages needed for deployment
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"