mrlectus commited on
Commit
ff111ad
·
verified ·
1 Parent(s): 8490d79

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -43
Dockerfile CHANGED
@@ -1,8 +1,6 @@
1
  # syntax=docker/dockerfile:1.4
2
 
3
- # Adapted from https://github.com/vercel/next.js/blob/e60a1e747c3f521fc24dfd9ee2989e13afeb0a9b/examples/with-docker/Dockerfile
4
- # For more information, see https://nextjs.org/docs/pages/building-your-application/deploying#docker-image
5
-
6
  FROM node:18 AS base
7
 
8
  # Install dependencies only when needed
@@ -18,54 +16,25 @@ RUN \
18
  else echo "Lockfile not found." && exit 1; \
19
  fi
20
 
21
-
22
- # Rebuild the source code only when needed
23
- FROM base AS builder
24
  WORKDIR /app
25
  COPY --from=deps --link /app/node_modules ./node_modules
26
  COPY --link . .
27
 
28
- # Next.js collects completely anonymous telemetry data about general usage.
29
- # Learn more here: https://nextjs.org/telemetry
30
- # Uncomment the following line in case you want to disable telemetry during the build.
31
- # ENV NEXT_TELEMETRY_DISABLED 1
32
-
33
- RUN npm run build
34
-
35
- # If using yarn comment out above and use below instead
36
- # RUN yarn build
37
-
38
- # Production image, copy all the files and run next
39
- FROM base AS runner
40
- WORKDIR /app
41
-
42
- ENV NODE_ENV production
43
- # Uncomment the following line in case you want to disable telemetry during runtime.
44
- # ENV NEXT_TELEMETRY_DISABLED 1
45
-
46
- RUN \
47
- addgroup --system --gid 1001 nodejs; \
48
- adduser --system --uid 1001 nextjs
49
-
50
- COPY --from=builder --link /app/public ./public
51
-
52
- # Automatically leverage output traces to reduce image size
53
- # https://nextjs.org/docs/advanced-features/output-file-tracing
54
- COPY --from=builder --link --chown=1001:1001 /app/.next/standalone ./
55
- COPY --from=builder --link --chown=1001:1001 /app/.next/static ./.next/static
56
-
57
- USER nextjs
58
-
59
  EXPOSE 3000
60
 
61
- ENV PORT 3000
62
- ENV HOSTNAME 0.0.0.0
63
-
64
- # Allow the running process to write model files to the cache folder.
65
- # NOTE: In practice, you would probably want to pre-download the model files to avoid having to download them on-the-fly.
66
  RUN mkdir -p /app/node_modules/@xenova/.cache/
67
  RUN mkdir -p /app/.cache/
68
  RUN chmod 777 -R /app/node_modules/@xenova/
69
  RUN chmod 777 -R /app/.cache
70
 
71
- CMD ["node", "server.js"]
 
 
 
 
 
 
 
1
  # syntax=docker/dockerfile:1.4
2
 
3
+ # Use the Node.js base image
 
 
4
  FROM node:18 AS base
5
 
6
  # Install dependencies only when needed
 
16
  else echo "Lockfile not found." && exit 1; \
17
  fi
18
 
19
+ # Prepare for development
20
+ FROM base AS dev
 
21
  WORKDIR /app
22
  COPY --from=deps --link /app/node_modules ./node_modules
23
  COPY --link . .
24
 
25
+ # Expose the port for development server
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  EXPOSE 3000
27
 
28
+ # Create and set proper permissions for .cache directories
 
 
 
 
29
  RUN mkdir -p /app/node_modules/@xenova/.cache/
30
  RUN mkdir -p /app/.cache/
31
  RUN chmod 777 -R /app/node_modules/@xenova/
32
  RUN chmod 777 -R /app/.cache
33
 
34
+ # Set environment variables for development
35
+ ENV NODE_ENV development
36
+ ENV PORT 3000
37
+ ENV HOSTNAME 0.0.0.0
38
+
39
+ # Start the development server
40
+ CMD ["npm", "run", "dev"]