diff --git a/.build/prod/compose.yml b/.build/prod/compose.yml index 9158ea0..99f2a9c 100644 --- a/.build/prod/compose.yml +++ b/.build/prod/compose.yml @@ -10,6 +10,8 @@ services: build: context: ../../ dockerfile: .build/prod/frontend.Dockerfile + args: + VITE_TURNSTILE_SITEKEY: ${VITE_TURNSTILE_SITEKEY} hostname: frontend image: git.shihaam.dev/mvdevsunion/wpetition/frontend depends_on: diff --git a/.build/prod/frontend.Dockerfile b/.build/prod/frontend.Dockerfile index da46658..65edfdd 100644 --- a/.build/prod/frontend.Dockerfile +++ b/.build/prod/frontend.Dockerfile @@ -1,6 +1,8 @@ # Build stage - compile the React/Vite app FROM node:20-alpine AS builder +ARG VITE_TURNSTILE_SITEKEY + WORKDIR /app # Copy package files first for better caching @@ -12,8 +14,8 @@ RUN npm ci # Copy source files COPY frontend-react/ ./ -# Build the production bundle -RUN npm run build +# Build the production bundle with env vars baked in +RUN VITE_TURNSTILE_SITEKEY=$VITE_TURNSTILE_SITEKEY npm run build # Production stage - serve with Nginx FROM nginx:alpine diff --git a/.gitignore b/.gitignore index ea6e644..7fc3570 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ riderModule.iml /.vs/ProjectEvaluation /Submission.Api/Petitions /Submission.Api/appsettings.json +.env diff --git a/frontend-react/src/components/signature/SignatureForm.tsx b/frontend-react/src/components/signature/SignatureForm.tsx index 08b63e7..3fc8940 100644 --- a/frontend-react/src/components/signature/SignatureForm.tsx +++ b/frontend-react/src/components/signature/SignatureForm.tsx @@ -256,7 +256,7 @@ export function SignatureForm({ language, onSubmit }: SignatureFormProps) { {/* Turnstile and Submit */}