From 9557833df6aec71e80a82ac544e7c34e85da3115 Mon Sep 17 00:00:00 2001 From: Lucid Date: Sat, 6 Dec 2025 20:52:00 -0500 Subject: [PATCH] added build args and variables --- .github/workflows/main.yml | 10 ++++++++-- Dockerfile | 4 ++++ src/app/api/graphql/route.ts | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index bfe46ef..daab704 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -53,7 +53,10 @@ jobs: context: . push: ${{ !github.event.pull_request.head.repo.fork }} tags: ${{ steps.meta.outputs.tags }} - build-args: API_URL=DATABASE_URL=${{ secrets.DATABASE_URL }} + build-args: | + DATABASE_URL=${{ secrets.DATABASE_URL }} + NEXT_PUBLIC_API_TOKEN=${{ secrets.NEXT_PUBLIC_API_TOKEN }} + NEXT_PUBLIC_GRAPHQL_URL=${{ secrets.NEXT_PUBLIC_GRAPHQL_URL }} - name: Build and Push Latest Docker Image id: build-and-push-latest uses: docker/build-push-action@v4 @@ -62,4 +65,7 @@ jobs: context: . push: true tags: ${{ env.REGISTRY }}/${{ env.OWNER }}/${{ env.IMAGE_NAME }}:latest - build-args: DATABASE_URL=${{ secrets.DATABASE_URL }} + build-args: | + DATABASE_URL=${{ secrets.DATABASE_URL }} + NEXT_PUBLIC_API_TOKEN=${{ secrets.NEXT_PUBLIC_API_TOKEN }} + NEXT_PUBLIC_GRAPHQL_URL=${{ secrets.NEXT_PUBLIC_GRAPHQL_URL }} diff --git a/Dockerfile b/Dockerfile index 3f9a35c..84f8a63 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,6 +26,10 @@ RUN corepack enable RUN corepack prepare yarn@stable --activate ARG DATABASE_URL ENV DATABASE_URL=${DATABASE_URL} +ARG NEXT_PUBLIC_GRAPHQL_URL +ENV NEXT_PUBLIC_GRAPHQL_URL=${NEXT_PUBLIC_GRAPHQL_URL} +ARG NEXT_PUBLIC_API_TOKEN +ENV NEXT_PUBLIC_API_TOKEN=${NEXT_PUBLIC_API_TOKEN} RUN corepack enable RUN corepack prepare yarn@stable --activate WORKDIR /app diff --git a/src/app/api/graphql/route.ts b/src/app/api/graphql/route.ts index 60b49be..a4ab196 100644 --- a/src/app/api/graphql/route.ts +++ b/src/app/api/graphql/route.ts @@ -58,7 +58,7 @@ const { handleRequest } = createYoga({ }), // While using Next.js file convention for routing, we need to configure Yoga to use the correct endpoint - graphqlEndpoint: "/api/graphql", + graphqlEndpoint: process.env.NEXT_PUBLIC_GRAPHQL_URL || "/api/graphql", // Yoga needs to know how to create a valid Next response fetchAPI: { Response },