Last active
August 16, 2024 08:30
-
-
Save mogeko/db936676e51e6985d6148c63a8f91df9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM node:22-bookworm AS base | |
ENV CI="true" PNPM_HOME="/root/pnpm" PATH="/root/pnpm:$PATH" | |
RUN corepack enable pnpm | |
WORKDIR /app | |
FROM base AS turbo-prune | |
COPY . /app | |
RUN --mount=type=cache,id=pnpm,target=/root/pnpm/store <<EOF | |
turbo_version=$(node -p "require('./package.json').devDependencies.turbo") | |
pnpm install --global "turbo@${turbo_version}" | |
EOF | |
RUN turbo prune web --docker | |
FROM base AS builder | |
COPY --from=turbo-prune /app/out/json /app | |
RUN --mount=type=cache,id=pnpm,target=/root/pnpm/store \ | |
pnpm install --frozen-lockfile | |
COPY --from=turbo-prune /app/out/full /app | |
RUN pnpm run build --filter=web | |
FROM gcr.io/distroless/nodejs22-debian12 | |
COPY --from=builder /app/apps/web/.next/standalone /app | |
COPY --from=builder /app/apps/web/.next/static /app/apps/web/.next/static | |
COPY --from=builder /app/apps/web/public /app/apps/web/public | |
ENV HOSTNAME="0.0.0.0" PORT="3000" | |
EXPOSE 3000 | |
CMD ["/app/apps/web/server.js"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment