CoolFace
Apppublic

matthoffner/serp-chat

sourceHugging Faceupdated 2y agoView on Hugging Face
5likes
Dockerfile62 linesDownload Raw Back to root
1FROM node:18 AS base2 3# Install dependencies only when needed4FROM base AS deps5 6WORKDIR /app7 8# Install dependencies based on the preferred package manager9COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./10RUN \11  if [ -f yarn.lock ]; then yarn --frozen-lockfile; \12  elif [ -f package-lock.json ]; then npm ci; \13  elif [ -f pnpm-lock.yaml ]; then yarn global add pnpm && pnpm i --frozen-lockfile; \14  else echo "Lockfile not found." && exit 1; \15  fi16 17# Uncomment the following lines if you want to use a secret at buildtime, 18# for example to access your private npm packages19# RUN --mount=type=secret,id=HF_EXAMPLE_SECRET,mode=0444,required=true \20#     $(cat /run/secrets/HF_EXAMPLE_SECRET)21 22# Rebuild the source code only when needed23FROM base AS builder24WORKDIR /app25COPY --from=deps /app/node_modules ./node_modules26COPY . .27 28# Next.js collects completely anonymous telemetry data about general usage.29# Learn more here: https://nextjs.org/telemetry30# Uncomment the following line in case you want to disable telemetry during the build.31# ENV NEXT_TELEMETRY_DISABLED 132 33# RUN yarn build34 35# If you use yarn, comment out this line and use the line above36RUN npm run build37 38# Production image, copy all the files and run next39FROM base AS runner40WORKDIR /app41 42ENV NODE_ENV production43# Uncomment the following line in case you want to disable telemetry during runtime.44# ENV NEXT_TELEMETRY_DISABLED 145 46RUN addgroup --system --gid 1001 nodejs47RUN adduser --system --uid 1001 nextjs48 49COPY --from=builder /app/public ./public50 51# Automatically leverage output traces to reduce image size52# https://nextjs.org/docs/advanced-features/output-file-tracing53COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./54COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static55 56USER nextjs57 58EXPOSE 300059 60ENV PORT 300061 62CMD ["node", "server.js"]