Spaces:
Sleeping
Sleeping
Pass Supabase keys as build arguments instead of hardcoding them
Browse files- Dockerfile +9 -0
- algospaced-ui/src/supabaseClient.ts +2 -2
Dockerfile
CHANGED
|
@@ -2,6 +2,15 @@
|
|
| 2 |
FROM node:20-alpine AS frontend-builder
|
| 3 |
WORKDIR /app/frontend
|
| 4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
# Copy package files and install dependencies
|
| 6 |
COPY algospaced-ui/package*.json ./
|
| 7 |
RUN npm install
|
|
|
|
| 2 |
FROM node:20-alpine AS frontend-builder
|
| 3 |
WORKDIR /app/frontend
|
| 4 |
|
| 5 |
+
# Declare build arguments (Hugging Face passes secrets as build args)
|
| 6 |
+
ARG VITE_SUPABASE_URL
|
| 7 |
+
ARG VITE_SUPABASE_ANON_KEY
|
| 8 |
+
|
| 9 |
+
# Expose them to Vite compilation environment
|
| 10 |
+
ENV VITE_SUPABASE_URL=$VITE_SUPABASE_URL
|
| 11 |
+
ENV VITE_SUPABASE_ANON_KEY=$VITE_SUPABASE_ANON_KEY
|
| 12 |
+
|
| 13 |
+
|
| 14 |
# Copy package files and install dependencies
|
| 15 |
COPY algospaced-ui/package*.json ./
|
| 16 |
RUN npm install
|
algospaced-ui/src/supabaseClient.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
import { createClient } from '@supabase/supabase-js';
|
| 2 |
|
| 3 |
-
const supabaseUrl = import.meta.env.VITE_SUPABASE_URL || '
|
| 4 |
-
const supabaseAnonKey = import.meta.env.VITE_SUPABASE_ANON_KEY || '
|
| 5 |
|
| 6 |
export const supabase = createClient(supabaseUrl, supabaseAnonKey);
|
| 7 |
|
|
|
|
| 1 |
import { createClient } from '@supabase/supabase-js';
|
| 2 |
|
| 3 |
+
const supabaseUrl = import.meta.env.VITE_SUPABASE_URL || '';
|
| 4 |
+
const supabaseAnonKey = import.meta.env.VITE_SUPABASE_ANON_KEY || '';
|
| 5 |
|
| 6 |
export const supabase = createClient(supabaseUrl, supabaseAnonKey);
|
| 7 |
|