Tina Tarighian commited on
Commit
6044c4d
·
1 Parent(s): 065d164
Files changed (3) hide show
  1. Dockerfile +59 -0
  2. README.md +14 -1
  3. next.config.mjs +4 -2
Dockerfile ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 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
+ # Uncomment the following line in case you want to disable telemetry during the build.
21
+ ENV NEXT_TELEMETRY_DISABLED 1
22
+
23
+ # Create .env.local if environment variables are provided
24
+ RUN touch .env.local
25
+ RUN if [ -n "$GEMINI_API_KEY" ]; then \
26
+ echo "GEMINI_API_KEY=$GEMINI_API_KEY" >> .env.local; \
27
+ fi
28
+
29
+ RUN npm run build
30
+
31
+ # Production image, copy all the files and run next
32
+ FROM base AS runner
33
+ WORKDIR /app
34
+
35
+ ENV NODE_ENV production
36
+ ENV NEXT_TELEMETRY_DISABLED 1
37
+
38
+ RUN addgroup --system --gid 1001 nodejs
39
+ RUN adduser --system --uid 1001 nextjs
40
+
41
+ COPY --from=builder /app/public ./public
42
+ COPY --from=builder /app/.env.local ./.env.local
43
+
44
+ # Set the correct permission for prerender cache
45
+ RUN mkdir .next
46
+ RUN chown nextjs:nodejs .next
47
+
48
+ # Automatically leverage output traces to reduce image size
49
+ COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
50
+ COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
51
+
52
+ USER nextjs
53
+
54
+ EXPOSE 3000
55
+
56
+ ENV PORT 3000
57
+ ENV HOSTNAME "0.0.0.0"
58
+
59
+ CMD ["node", "server.js"]
README.md CHANGED
@@ -1,3 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  # HandSpew
2
 
3
  HandSpew is a simple web application that uses MediaPipe for hand landmark detection and Gemini 2.0 Flash for generating thoughts based on hand gestures. When you open your hand like a puppet mouth (thumb not touching other fingers), the app generates a thought related to what the camera sees.
@@ -59,7 +72,7 @@ npm run dev
59
 
60
  1. Create a new Space on Hugging Face
61
  2. Connect your GitHub repository
62
- 3. Add your Gemini API key as a secret in the Space settings
63
  4. Deploy the app
64
 
65
  ## Technologies Used
 
1
+ ---
2
+ title: HandSpew
3
+ emoji: 👋
4
+ colorFrom: green
5
+ colorTo: blue
6
+ sdk: docker
7
+ sdk_version: 3.0.0
8
+ app_port: 3000
9
+ pinned: false
10
+ ---
11
+
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
13
+
14
  # HandSpew
15
 
16
  HandSpew is a simple web application that uses MediaPipe for hand landmark detection and Gemini 2.0 Flash for generating thoughts based on hand gestures. When you open your hand like a puppet mouth (thumb not touching other fingers), the app generates a thought related to what the camera sees.
 
72
 
73
  1. Create a new Space on Hugging Face
74
  2. Connect your GitHub repository
75
+ 3. Add your Gemini API key as a secret in the Space settings with the name `GEMINI_API_KEY`
76
  4. Deploy the app
77
 
78
  ## Technologies Used
next.config.mjs CHANGED
@@ -1,8 +1,10 @@
1
  /** @type {import('next').NextConfig} */
2
  const nextConfig = {
3
  reactStrictMode: true,
4
- env: {
5
- GEMINI_API_KEY: process.env.GEMINI_API_KEY,
 
 
6
  },
7
  };
8
 
 
1
  /** @type {import('next').NextConfig} */
2
  const nextConfig = {
3
  reactStrictMode: true,
4
+ output: 'standalone',
5
+ images: {
6
+ domains: ['localhost'],
7
+ unoptimized: true,
8
  },
9
  };
10