SherlockRamos commited on
Commit
32e6ed7
·
verified ·
1 Parent(s): f73633e

Upload Dockerfile with huggingface_hub

Browse files
Files changed (1) hide show
  1. Dockerfile +57 -0
Dockerfile ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM node:18-alpine AS base
2
+
3
+ # Install dependencies only when needed
4
+ FROM base AS deps
5
+ RUN apk add --no-cache libc6-compat
6
+ WORKDIR /app
7
+
8
+ # Install dependencies based on the preferred package manager
9
+ COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./
10
+ RUN \
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
+ fi
16
+
17
+ # Rebuild the source code only when needed
18
+ FROM base AS builder
19
+ WORKDIR /app
20
+ COPY --from=deps /app/node_modules ./node_modules
21
+ COPY . .
22
+
23
+ # Next.js collects completely anonymous telemetry data about general usage.
24
+ # Learn more here: https://nextjs.org/telemetry
25
+ # Uncomment the following line in case you want to disable telemetry during the build.
26
+ ENV NEXT_TELEMETRY_DISABLED 1
27
+
28
+ RUN npm run build
29
+
30
+ # Production image, copy all the files and run next
31
+ FROM base AS runner
32
+ WORKDIR /app
33
+
34
+ ENV NODE_ENV production
35
+ ENV NEXT_TELEMETRY_DISABLED 1
36
+
37
+ RUN addgroup --system --gid 1001 nodejs
38
+ RUN adduser --system --uid 1001 nextjs
39
+
40
+ COPY --from=builder /app/public ./public
41
+
42
+ # Set the correct permission for prerender cache
43
+ RUN mkdir .next
44
+ RUN chown nextjs:nodejs .next
45
+
46
+ # Automatically leverage output traces to reduce image size
47
+ # https://nextjs.org/docs/advanced-features/output-file-tracing
48
+ COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
49
+ COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
50
+
51
+ USER nextjs
52
+
53
+ EXPOSE 3000
54
+
55
+ ENV PORT 3000
56
+
57
+ CMD ["node", "server.js"]