Esteves Enzo commited on
Commit
d6ff67a
1 Parent(s): 8518e73

update dockerfile

Browse files
Files changed (2) hide show
  1. Dockerfile +15 -59
  2. next.config.js +1 -1
Dockerfile CHANGED
@@ -1,69 +1,25 @@
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
9
- FROM base AS deps
10
- WORKDIR /app
11
 
12
- # Install dependencies based on the preferred package manager
13
- COPY --link package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./
14
- RUN \
15
- if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
16
- elif [ -f package-lock.json ]; then npm ci; \
17
- elif [ -f pnpm-lock.yaml ]; then yarn global add pnpm && pnpm i --frozen-lockfile; \
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 localhost
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 chmod 777 -R /app/node_modules/@xenova/
68
-
69
- CMD ["node", ".next/standalone/server.js"]
 
1
+ # Dockerfile
2
 
3
+ # Use an official Node.js runtime as the base image
4
+ FROM node:18
5
 
6
+ # Set the working directory in the container
7
+ WORKDIR /usr/src/app
8
 
9
+ # Copy package.json and package-lock.json to the container
10
+ COPY package.json package-lock.json ./
 
11
 
12
+ # Install dependencies
13
+ RUN npm install
 
 
 
 
 
 
14
 
15
+ # Copy the rest of the application files to the container
16
+ COPY . .
17
 
18
+ # Build the Next.js application for production
 
 
 
 
 
 
 
 
 
 
19
  RUN npm run build
20
 
21
+ # Expose the application port (assuming your app runs on port 3000)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  EXPOSE 3000
23
 
24
+ # Start the application
25
+ CMD ["npm", "start"]
 
 
 
 
 
 
 
next.config.js CHANGED
@@ -1,7 +1,7 @@
1
  /** @type {import('next').NextConfig} */
2
  const nextConfig = {
3
- output: 'standalone',
4
  experimental: {
 
5
  serverComponentsExternalPackages: ['sharp', 'onnxruntime-node'],
6
  },
7
  }
 
1
  /** @type {import('next').NextConfig} */
2
  const nextConfig = {
 
3
  experimental: {
4
+ serverActions: true,
5
  serverComponentsExternalPackages: ['sharp', 'onnxruntime-node'],
6
  },
7
  }