2022-03-13 21:27:32 -05:00
|
|
|
FROM node:16 AS deps
|
2022-03-13 21:13:18 -05:00
|
|
|
WORKDIR /build
|
|
|
|
|
2022-06-06 18:38:15 -05:00
|
|
|
COPY .yarn .yarn
|
|
|
|
COPY package.json yarn.lock .yarnrc.yml ./
|
2022-03-13 21:13:18 -05:00
|
|
|
|
2022-06-06 18:38:15 -05:00
|
|
|
RUN yarn install --immutable
|
2022-03-13 21:13:18 -05:00
|
|
|
|
2022-03-13 21:27:32 -05:00
|
|
|
FROM node:16 AS builder
|
2022-03-13 21:13:18 -05:00
|
|
|
WORKDIR /build
|
|
|
|
|
|
|
|
COPY --from=deps /build/node_modules ./node_modules
|
|
|
|
COPY src ./src
|
|
|
|
COPY scripts ./scripts
|
|
|
|
COPY prisma ./prisma
|
2022-06-06 18:38:15 -05:00
|
|
|
COPY .yarn .yarn
|
|
|
|
COPY package.json yarn.lock .yarnrc.yml esbuild.config.js next.config.js next-env.d.ts zip-env.d.ts tsconfig.json ./
|
2022-03-13 21:13:18 -05:00
|
|
|
|
|
|
|
ENV ZIPLINE_DOCKER_BUILD 1
|
|
|
|
ENV NEXT_TELEMETRY_DISABLED 1
|
|
|
|
|
|
|
|
RUN yarn build
|
|
|
|
|
2022-03-13 21:27:32 -05:00
|
|
|
FROM node:16 AS runner
|
2022-03-13 21:13:18 -05:00
|
|
|
WORKDIR /zipline
|
|
|
|
|
|
|
|
ENV NODE_ENV production
|
|
|
|
ENV NEXT_TELEMETRY_DISABLED 1
|
|
|
|
|
|
|
|
RUN addgroup --system --gid 1001 zipline
|
|
|
|
RUN adduser --system --uid 1001 zipline
|
|
|
|
|
|
|
|
COPY --from=builder --chown=zipline:zipline /build/.next ./.next
|
|
|
|
COPY --from=builder --chown=zipline:zipline /build/dist ./dist
|
|
|
|
COPY --from=builder --chown=zipline:zipline /build/node_modules ./node_modules
|
|
|
|
|
|
|
|
COPY --from=builder /build/next.config.js ./next.config.js
|
|
|
|
COPY --from=builder /build/src ./src
|
|
|
|
COPY --from=builder /build/scripts ./scripts
|
|
|
|
COPY --from=builder /build/prisma ./prisma
|
|
|
|
COPY --from=builder /build/tsconfig.json ./tsconfig.json
|
|
|
|
COPY --from=builder /build/package.json ./package.json
|
|
|
|
|
|
|
|
USER zipline
|
|
|
|
|
|
|
|
CMD ["node", "dist/server"]
|