diff --git a/Dockerfile b/Dockerfile index 43970b20..b6bbd710 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,6 +13,12 @@ RUN npm install # Copy the rest of the frontend source code COPY frontend/ ./ +# Add the build argument for the backend API URL to be used by the frontend +ARG VITE_API_URL + +# Set the environment variable so Vite can access the backend API URL during build +ENV VITE_API_URL=${VITE_API_URL} + # Build the frontend RUN npm run build diff --git a/backend/.env.example b/backend/.env.example index fde5f6ba..6fb7fbfa 100644 --- a/backend/.env.example +++ b/backend/.env.example @@ -1 +1,3 @@ -# GEMINI_API_KEY= \ No newline at end of file +# GEMINI_API_KEY= +# LANGSMITH_API_KEY= +# VITE_API_URL=http://localhost:8123 \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 6cec5c05..708db0f1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -28,6 +28,11 @@ services: retries: 5 interval: 5s langgraph-api: + build: + context: . + dockerfile: Dockerfile + args: + VITE_API_URL: ${VITE_API_URL} image: gemini-fullstack-langgraph container_name: langgraph-api ports: diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index d06d4021..1be708cb 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -22,9 +22,9 @@ export default function App() { max_research_loops: number; reasoning_model: string; }>({ - apiUrl: import.meta.env.DEV + apiUrl: import.meta.env.VITE_API_URL || (import.meta.env.DEV ? "http://localhost:2024" - : "http://localhost:8123", + : "http://localhost:8123"), assistantId: "agent", messagesKey: "messages", onUpdateEvent: (event: any) => {