CoolFace
Apppublic

jbilcke-hf/ai-comic-factory

sourceHugging Faceupdated 11mo agoView on Hugging Face
11klikes
Dockerfile66 linesDownload Raw Back to root
1FROM node:20-alpine AS base2 3# Install dependencies only when needed4FROM base AS deps5# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.6RUN apk add --no-cache libc6-compat7WORKDIR /app8 9# Install dependencies based on the preferred package manager10COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./11RUN \12  if [ -f yarn.lock ]; then yarn --frozen-lockfile; \13  elif [ -f package-lock.json ]; then npm ci; \14  elif [ -f pnpm-lock.yaml ]; then yarn global add pnpm && pnpm i --frozen-lockfile; \15  else echo "Lockfile not found." && exit 1; \16  fi17 18# Uncomment the following lines if you want to use a secret at buildtime, 19# for example to access your private npm packages20# RUN --mount=type=secret,id=HF_EXAMPLE_SECRET,mode=0444,required=true \21#     $(cat /run/secrets/HF_EXAMPLE_SECRET)22 23# Rebuild the source code only when needed24FROM base AS builder25WORKDIR /app26COPY --from=deps /app/node_modules ./node_modules27COPY . .28 29# Next.js collects completely anonymous telemetry data about general usage.30# Learn more here: https://nextjs.org/telemetry31# Uncomment the following line in case you want to disable telemetry during the build.32# ENV NEXT_TELEMETRY_DISABLED 133 34# RUN yarn build35 36# If you use yarn, comment out this line and use the line above37RUN npm run build38 39# Production image, copy all the files and run next40FROM base AS runner41WORKDIR /app42 43ENV NODE_ENV production44# Uncomment the following line in case you want to disable telemetry during runtime.45# ENV NEXT_TELEMETRY_DISABLED 146 47RUN addgroup --system --gid 1001 nodejs48RUN adduser --system --uid 1001 nextjs49 50COPY --from=builder /app/public ./public51 52# Automatically leverage output traces to reduce image size53# https://nextjs.org/docs/advanced-features/output-file-tracing54COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./55COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static56COPY --from=builder --chown=nextjs:nodejs /app/.next/cache ./.next/cache57# COPY --from=builder --chown=nextjs:nodejs /app/.next/cache/fetch-cache ./.next/cache/fetch-cache58 59USER nextjs60 61EXPOSE 300062 63ENV PORT 300064 65CMD ["node", "server.js"]66