Spaces:
Sleeping
Sleeping
[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- Dockerfile +8 -2
- package-lock.json +1 -1
- 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 |
-
#
|
| 15 |
-
#
|
| 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": "
|
| 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
|
| 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 |
}
|