mihirmithani commited on
Commit
a320533
·
1 Parent(s): a371b77

Add HF Space configuration

Browse files

- Add YAML frontmatter to README.md for Space config
- Add Dockerfile for container deployment
- Enable standalone output in next.config.ts
- Specify docker SDK in Space metadata

Files changed (3) hide show
  1. Dockerfile +50 -0
  2. README.md +11 -0
  3. next.config.ts +6 -2
Dockerfile ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use Node.js 20 LTS as base image
2
+ FROM node:20-alpine AS base
3
+
4
+ # Install dependencies only when needed
5
+ FROM base AS deps
6
+ RUN apk add --no-cache libc6-compat
7
+ WORKDIR /app
8
+
9
+ COPY package.json package-lock.json* ./
10
+ RUN npm ci
11
+
12
+ # Rebuild the source code only when needed
13
+ FROM base AS builder
14
+ WORKDIR /app
15
+ COPY --from=deps /app/node_modules ./node_modules
16
+ COPY . .
17
+
18
+ # Next.js collects completely anonymous telemetry data about general usage.
19
+ # Learn more here: https://nextjs.org/telemetry
20
+ ENV NEXT_TELEMETRY_DISABLED=1
21
+
22
+ RUN npm run build
23
+
24
+ # Production image, copy all the files and run next
25
+ FROM base AS runner
26
+ WORKDIR /app
27
+
28
+ ENV NODE_ENV=production
29
+ ENV NEXT_TELEMETRY_DISABLED=1
30
+
31
+ RUN addgroup --system --gid 1001 nodejs
32
+ RUN adduser --system --uid 1001 nextjs
33
+
34
+ COPY --from=builder /app/public ./public
35
+
36
+ # Set the correct permission for prerender cache
37
+ mkdir .next
38
+ chown nextjs:nodejs .next
39
+
40
+ COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
41
+ COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
42
+
43
+ USER nextjs
44
+
45
+ EXPOSE 7860
46
+
47
+ ENV PORT=7860
48
+ ENV HOSTNAME="0.0.0.0"
49
+
50
+ CMD ["node", "server.js"]
README.md CHANGED
@@ -1,3 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
1
  # Interactive Kernel Convolution Visualizer
2
 
3
  An educational web application that demonstrates how image convolution works in real-time. Upload any image, choose from predefined kernels or create your own, and watch the convolution process step-by-step with detailed mathematical visualization.
 
1
+ ---
2
+ title: Kernel Convolution Visualizer
3
+ emoji: 🔍
4
+ colorFrom: blue
5
+ colorTo: purple
6
+ sdk: docker
7
+ sdk_version: "latest"
8
+ app_file: Dockerfile
9
+ pinned: false
10
+ ---
11
+
12
  # Interactive Kernel Convolution Visualizer
13
 
14
  An educational web application that demonstrates how image convolution works in real-time. Upload any image, choose from predefined kernels or create your own, and watch the convolution process step-by-step with detailed mathematical visualization.
next.config.ts CHANGED
@@ -1,8 +1,10 @@
1
  import type { NextConfig } from "next";
2
 
3
  const nextConfig: NextConfig = {
4
- // Disable Turbopack for now due to webpack config
5
- turbopack: {},
 
 
6
  // Enable experimental features for better performance
7
  experimental: {
8
  optimizePackageImports: ['lucide-react'],
@@ -16,6 +18,8 @@ const nextConfig: NextConfig = {
16
  },
17
  ],
18
  },
 
 
19
  };
20
 
21
  export default nextConfig;
 
1
  import type { NextConfig } from "next";
2
 
3
  const nextConfig: NextConfig = {
4
+ // Configure Turbopack root to avoid parent directory conflicts
5
+ turbopack: {
6
+ root: __dirname,
7
+ },
8
  // Enable experimental features for better performance
9
  experimental: {
10
  optimizePackageImports: ['lucide-react'],
 
18
  },
19
  ],
20
  },
21
+ // Enable standalone output for Docker
22
+ output: 'standalone',
23
  };
24
 
25
  export default nextConfig;