[dyad] commited on
Commit
7905940
·
1 Parent(s): 2df2699

[dyad] Fixing environment variable issues - wrote 2 file(s) + extra files edited outside of Dyad

Browse files
Files changed (3) hide show
  1. Dockerfile +8 -2
  2. package-lock.json +1 -1
  3. src/pages/Index.tsx +1 -1
Dockerfile CHANGED
@@ -1,6 +1,12 @@
1
  # Stage 1: Build the application
2
  # Use a specific Node.js version for consistency
3
  FROM node:20-alpine AS builder
 
 
 
 
 
 
4
  WORKDIR /app
5
 
6
  # Copy package files and install dependencies
@@ -11,8 +17,8 @@ RUN npm install
11
  COPY . .
12
 
13
  # Build the application.
14
- # Hugging Face Spaces automatically provides secrets as environment variables.
15
- # Vite will use these environment variables during the build process.
16
  RUN npm run build
17
 
18
  # Stage 2: Serve the application
 
1
  # Stage 1: Build the application
2
  # Use a specific Node.js version for consistency
3
  FROM node:20-alpine AS builder
4
+
5
+ # Explicitly declare the build argument we expect from Hugging Face secrets
6
+ ARG VITE_GEMINI_API_KEY
7
+ # Set it as an environment variable for the build process
8
+ ENV VITE_GEMINI_API_KEY=$VITE_GEMINI_API_KEY
9
+
10
  WORKDIR /app
11
 
12
  # Copy package files and install dependencies
 
17
  COPY . .
18
 
19
  # Build the application.
20
+ # Vite will now replace import.meta.env.VITE_GEMINI_API_KEY with the value
21
+ # of the environment variable we just set.
22
  RUN npm run build
23
 
24
  # Stage 2: Serve the application
package-lock.json CHANGED
@@ -1,5 +1,5 @@
1
  {
2
- "name": "energetic-tardigrade-burst",
3
  "version": "0.0.0",
4
  "lockfileVersion": 3,
5
  "requires": true,
 
1
  {
2
+ "name": "fpv1-copy",
3
  "version": "0.0.0",
4
  "lockfileVersion": 3,
5
  "requires": true,
src/pages/Index.tsx CHANGED
@@ -55,7 +55,7 @@ const Index = () => {
55
  setIsAIReady(false);
56
  toast({
57
  title: "AI Not Ready",
58
- description: "Gemini API key is not configured. Please set VITE_GEMINI_API_KEY in your .env file.",
59
  variant: "destructive",
60
  });
61
  }
 
55
  setIsAIReady(false);
56
  toast({
57
  title: "AI Not Ready",
58
+ description: "Gemini API key is not configured. Please set it in your deployment environment secrets.",
59
  variant: "destructive",
60
  });
61
  }