ChandimaPrabath commited on
Commit
255daa0
1 Parent(s): ebf85b4

nextjs image cache dir

Browse files
Files changed (2) hide show
  1. Dockerfile +5 -3
  2. frontend/next.config.mjs +1 -0
Dockerfile CHANGED
@@ -22,10 +22,9 @@ WORKDIR /app
22
  # Copy the Next.js build and node_modules from the builder stage
23
  COPY --from=builder /app /app
24
 
25
- # Create the cache directory and set permissions
26
  RUN mkdir -p /tmp/app/.next/cache && \
27
- chmod -R 777 /tmp/app/.next && \
28
- ln -s /tmp/app/.next/cache /app/.next/cache
29
 
30
  # Install PM2 globally
31
  RUN npm install -g pm2
@@ -36,5 +35,8 @@ EXPOSE 7860
36
  # Set the PORT environment variable
37
  ENV PORT=7860
38
 
 
 
 
39
  # Start Next.js with PM2
40
  CMD ["pm2-runtime", "start", "npm", "--", "start"]
 
22
  # Copy the Next.js build and node_modules from the builder stage
23
  COPY --from=builder /app /app
24
 
25
+ # Create the cache directory in /tmp and set permissions
26
  RUN mkdir -p /tmp/app/.next/cache && \
27
+ chmod -R 777 /tmp/app/.next
 
28
 
29
  # Install PM2 globally
30
  RUN npm install -g pm2
 
35
  # Set the PORT environment variable
36
  ENV PORT=7860
37
 
38
+ # Set Next.js environment variables to use the /tmp cache directory
39
+ ENV NEXT_CACHE_DIR=/tmp/app/.next/cache
40
+
41
  # Start Next.js with PM2
42
  CMD ["pm2-runtime", "start", "npm", "--", "start"]
frontend/next.config.mjs CHANGED
@@ -2,6 +2,7 @@
2
  const nextConfig = {
3
  images: {
4
  domains: ['artworks.thetvdb.com'],
 
5
  },
6
  };
7
 
 
2
  const nextConfig = {
3
  images: {
4
  domains: ['artworks.thetvdb.com'],
5
+ cacheDirectory: '/tmp/app/.next/cache'
6
  },
7
  };
8