zipline/Dockerfile
2024-12-16 14:46:20 -08:00

44 lines
No EOL
1 KiB
Docker
Executable file

FROM node:20-alpine3.19 AS base
ENV PNPM_HOME="/pnpm"
RUN corepack enable pnpm
RUN corepack prepare pnpm@latest --activate
WORKDIR /zipline
COPY prisma ./prisma
COPY package.json .
COPY pnpm-lock.yaml .
FROM base AS deps
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile
FROM base AS builder
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
COPY src ./src
COPY next.config.js ./next.config.js
COPY tsup.config.ts ./tsup.config.ts
COPY tsconfig.json ./tsconfig.json
COPY mimes.json ./mimes.json
COPY code.json ./code.json
ENV NEXT_TELEMETRY_DISABLED=1 \
NODE_ENV=production
RUN ZIPLINE_BUILD=true pnpm run build
FROM base
COPY --from=deps /zipline/node_modules ./node_modules
COPY --from=builder /zipline/build ./build
COPY --from=builder /zipline/.next ./.next
COPY --from=builder /zipline/mimes.json ./mimes.json
COPY --from=builder /zipline/code.json ./code.json
# clean
RUN rm -rf /tmp/* /root/*
CMD ["node", "--enable-source-maps", "build/server"]