diff --git a/.github/workflows/ghcr.yaml b/.github/workflows/ghcr.yaml index 1eea2fa18..190f17f98 100644 --- a/.github/workflows/ghcr.yaml +++ b/.github/workflows/ghcr.yaml @@ -45,24 +45,25 @@ jobs: uses: docker/build-push-action@v4 with: context: . + file: ./Dockerfile-general push: true tags: | ghcr.io/chatcrm/bizgpt-frontend-2_0:sarmad build-args: | OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} - NEXT_PUBLIC_SUPABASE_ANON_KEY: ${{ env.NEXT_PUBLIC_SUPABASE_ANON_KEY }} - NEXT_PUBLIC_SUPABASE_BUCKET_NAME: ${{ env.NEXT_PUBLIC_SUPABASE_BUCKET_NAME }} - NEXT_PUBLIC_SUPABASE_SCHEMA: ${{ env.NEXT_PUBLIC_SUPABASE_SCHEMA }} - NEXT_PUBLIC_SUPABASE_URL: ${{ env.NEXT_PUBLIC_SUPABASE_URL }} - NEXT_SUPABASE_SERVICE_ROLE_KEY: ${{ env.NEXT_SUPABASE_SERVICE_ROLE_KEY }} - OPENAI_ASSISTANT_ID: ${{ env.OPENAI_ASSISTANT_ID }} - NEXT_PUBLIC_BIZGPT_FRONTEND_LANGUAGE: ${{ env.NEXT_PUBLIC_BIZGPT_FRONTEND_LANGUAGE}} - NEXT_PUBLIC_CLIENT_BRANDING_NAME: ${{ env.NEXT_PUBLIC_CLIENT_BRANDING_NAME}} - NEXT_PUBLIC_EMPTY_TEXT_BODY: ${{ env.NEXT_PUBLIC_EMPTY_TEXT_BODY}} - NEXT_PUBLIC_EMPTY_TEXT_HEADER: ${{ env.NEXT_PUBLIC_EMPTY_TEXT_HEADER}} - NEXT_PUBLIC_FOOTER_CLIENT_TEXT: ${{ env.NEXT_PUBLIC_FOOTER_CLIENT_TEXT}} - NEXT_PUBLIC_OUTLINE_ADDRESS: ${{ env.NEXT_PUBLIC_OUTLINE_ADDRESS}} - NEXT_PUBLIC_TEXT_DIRECTION: ${{ env.NEXT_PUBLIC_TEXT_DIRECTION}} - NEXT_PUBLIC_USE_EXAMPLE_MESSAGES: ${{ env.NEXT_PUBLIC_USE_EXAMPLE_MESSAGES}} - NEXT_PUBLIC_USE_FOOTER_CLIENT_TEXT: ${{ env.NEXT_PUBLIC_USE_FOOTER_CLIENT_TEXT}} - SITE_URL: ${{ env.SITE_URL}} + NEXT_PUBLIC_SUPABASE_ANON_KEY=${{ env.NEXT_PUBLIC_SUPABASE_ANON_KEY }} + NEXT_PUBLIC_SUPABASE_BUCKET_NAME=${{ env.NEXT_PUBLIC_SUPABASE_BUCKET_NAME }} + NEXT_PUBLIC_SUPABASE_SCHEMA=${{ env.NEXT_PUBLIC_SUPABASE_SCHEMA }} + NEXT_PUBLIC_SUPABASE_URL=${{ env.NEXT_PUBLIC_SUPABASE_URL }} + NEXT_SUPABASE_SERVICE_ROLE_KEY=${{ env.NEXT_SUPABASE_SERVICE_ROLE_KEY }} + OPENAI_ASSISTANT_ID=${{ env.OPENAI_ASSISTANT_ID }} + NEXT_PUBLIC_BIZGPT_FRONTEND_LANGUAGE=${{ env.NEXT_PUBLIC_BIZGPT_FRONTEND_LANGUAGE }} + NEXT_PUBLIC_CLIENT_BRANDING_NAME=${{ env.NEXT_PUBLIC_CLIENT_BRANDING_NAME }} + NEXT_PUBLIC_EMPTY_TEXT_BODY=${{ env.NEXT_PUBLIC_EMPTY_TEXT_BODY }} + NEXT_PUBLIC_EMPTY_TEXT_HEADER=${{ env.NEXT_PUBLIC_EMPTY_TEXT_HEADER }} + NEXT_PUBLIC_FOOTER_CLIENT_TEXT=${{ env.NEXT_PUBLIC_FOOTER_CLIENT_TEXT }} + NEXT_PUBLIC_OUTLINE_ADDRESS=${{ env.NEXT_PUBLIC_OUTLINE_ADDRESS }} + NEXT_PUBLIC_TEXT_DIRECTION=${{ env.NEXT_PUBLIC_TEXT_DIRECTION }} + NEXT_PUBLIC_USE_EXAMPLE_MESSAGES=${{ env.NEXT_PUBLIC_USE_EXAMPLE_MESSAGES }} + NEXT_PUBLIC_USE_FOOTER_CLIENT_TEXT=${{ env.NEXT_PUBLIC_USE_FOOTER_CLIENT_TEXT }} + SITE_URL=${{ env.SITE_URL }} diff --git a/Dockerfile-general b/Dockerfile-general index 584f3857c..6f2aff983 100644 --- a/Dockerfile-general +++ b/Dockerfile-general @@ -1,56 +1,56 @@ # Use Node.js 20 as the base image FROM node:20-alpine AS base -# ARG OPENAI_API_KEY -# ENV OPENAI_API_KEY=$OPENAI_API_KEY +ARG OPENAI_API_KEY +ENV OPENAI_API_KEY=$OPENAI_API_KEY -# ARG NEXT_PUBLIC_SUPABASE_ANON_KEY -# ENV NEXT_PUBLIC_SUPABASE_ANON_KEY=$NEXT_PUBLIC_SUPABASE_ANON_KEY +ARG NEXT_PUBLIC_SUPABASE_ANON_KEY +ENV NEXT_PUBLIC_SUPABASE_ANON_KEY=$NEXT_PUBLIC_SUPABASE_ANON_KEY -# ARG NEXT_PUBLIC_SUPABASE_BUCKET_NAME -# ENV NEXT_PUBLIC_SUPABASE_BUCKET_NAME=$NEXT_PUBLIC_SUPABASE_BUCKET_NAME +ARG NEXT_PUBLIC_SUPABASE_BUCKET_NAME +ENV NEXT_PUBLIC_SUPABASE_BUCKET_NAME=$NEXT_PUBLIC_SUPABASE_BUCKET_NAME -# ARG NEXT_PUBLIC_SUPABASE_SCHEMA -# ENV NEXT_PUBLIC_SUPABASE_SCHEMA=$NEXT_PUBLIC_SUPABASE_SCHEMA +ARG NEXT_PUBLIC_SUPABASE_SCHEMA +ENV NEXT_PUBLIC_SUPABASE_SCHEMA=$NEXT_PUBLIC_SUPABASE_SCHEMA -# ARG NEXT_PUBLIC_SUPABASE_URL -# ENV NEXT_PUBLIC_SUPABASE_URL=$NEXT_PUBLIC_SUPABASE_URL +ARG NEXT_PUBLIC_SUPABASE_URL +ENV NEXT_PUBLIC_SUPABASE_URL=$NEXT_PUBLIC_SUPABASE_URL -# ARG NEXT_SUPABASE_SERVICE_ROLE_KEY -# ENV NEXT_SUPABASE_SERVICE_ROLE_KEY=$NEXT_SUPABASE_SERVICE_ROLE_KEY +ARG NEXT_SUPABASE_SERVICE_ROLE_KEY +ENV NEXT_SUPABASE_SERVICE_ROLE_KEY=$NEXT_SUPABASE_SERVICE_ROLE_KEY -# ARG OPENAI_ASSISTANT_ID -# ENV OPENAI_ASSISTANT_ID=$OPENAI_ASSISTANT_ID +ARG OPENAI_ASSISTANT_ID +ENV OPENAI_ASSISTANT_ID=$OPENAI_ASSISTANT_ID -# ARG NEXT_PUBLIC_BIZGPT_FRONTEND_LANGUAGE -# ENV NEXT_PUBLIC_BIZGPT_FRONTEND_LANGUAGE=$NEXT_PUBLIC_BIZGPT_FRONTEND_LANGUAGE +ARG NEXT_PUBLIC_BIZGPT_FRONTEND_LANGUAGE +ENV NEXT_PUBLIC_BIZGPT_FRONTEND_LANGUAGE=$NEXT_PUBLIC_BIZGPT_FRONTEND_LANGUAGE -# ARG NEXT_PUBLIC_CLIENT_BRANDING_NAME -# ENV NEXT_PUBLIC_CLIENT_BRANDING_NAME=$NEXT_PUBLIC_CLIENT_BRANDING_NAME +ARG NEXT_PUBLIC_CLIENT_BRANDING_NAME +ENV NEXT_PUBLIC_CLIENT_BRANDING_NAME=$NEXT_PUBLIC_CLIENT_BRANDING_NAME -# ARG NEXT_PUBLIC_EMPTY_TEXT_BODY -# ENV NEXT_PUBLIC_EMPTY_TEXT_BODY=$NEXT_PUBLIC_EMPTY_TEXT_BODY +ARG NEXT_PUBLIC_EMPTY_TEXT_BODY +ENV NEXT_PUBLIC_EMPTY_TEXT_BODY=$NEXT_PUBLIC_EMPTY_TEXT_BODY -# ARG NEXT_PUBLIC_EMPTY_TEXT_HEADER -# ENV NEXT_PUBLIC_EMPTY_TEXT_HEADER=$NEXT_PUBLIC_EMPTY_TEXT_HEADER +ARG NEXT_PUBLIC_EMPTY_TEXT_HEADER +ENV NEXT_PUBLIC_EMPTY_TEXT_HEADER=$NEXT_PUBLIC_EMPTY_TEXT_HEADER -# ARG NEXT_PUBLIC_FOOTER_CLIENT_TEXT -# ENV NEXT_PUBLIC_FOOTER_CLIENT_TEXT=$NEXT_PUBLIC_FOOTER_CLIENT_TEXT +ARG NEXT_PUBLIC_FOOTER_CLIENT_TEXT +ENV NEXT_PUBLIC_FOOTER_CLIENT_TEXT=$NEXT_PUBLIC_FOOTER_CLIENT_TEXT -# ARG NEXT_PUBLIC_OUTLINE_ADDRESS -# ENV NEXT_PUBLIC_OUTLINE_ADDRESS=$NEXT_PUBLIC_OUTLINE_ADDRESS +ARG NEXT_PUBLIC_OUTLINE_ADDRESS +ENV NEXT_PUBLIC_OUTLINE_ADDRESS=$NEXT_PUBLIC_OUTLINE_ADDRESS -# ARG NEXT_PUBLIC_TEXT_DIRECTION -# ENV NEXT_PUBLIC_TEXT_DIRECTION=$NEXT_PUBLIC_TEXT_DIRECTION +ARG NEXT_PUBLIC_TEXT_DIRECTION +ENV NEXT_PUBLIC_TEXT_DIRECTION=$NEXT_PUBLIC_TEXT_DIRECTION -# ARG NEXT_PUBLIC_USE_EXAMPLE_MESSAGES -# ENV NEXT_PUBLIC_USE_EXAMPLE_MESSAGES=$NEXT_PUBLIC_USE_EXAMPLE_MESSAGES +ARG NEXT_PUBLIC_USE_EXAMPLE_MESSAGES +ENV NEXT_PUBLIC_USE_EXAMPLE_MESSAGES=$NEXT_PUBLIC_USE_EXAMPLE_MESSAGES -# ARG NEXT_PUBLIC_USE_FOOTER_CLIENT_TEXT -# ENV NEXT_PUBLIC_USE_FOOTER_CLIENT_TEXT=$NEXT_PUBLIC_USE_FOOTER_CLIENT_TEXT +ARG NEXT_PUBLIC_USE_FOOTER_CLIENT_TEXT +ENV NEXT_PUBLIC_USE_FOOTER_CLIENT_TEXT=$NEXT_PUBLIC_USE_FOOTER_CLIENT_TEXT -# ARG SITE_URL -# ENV SITE_URL=$SITE_URL +ARG SITE_URL +ENV SITE_URL=$SITE_URL # Install pnpm RUN npm install -g pnpm @@ -68,7 +68,6 @@ RUN if [ -f pnpm-lock.yaml ]; then pnpm install --frozen-lockfile; \ # Copy the rest of the application code COPY . . -COPY .env .env # Build the Next.js app RUN pnpm build @@ -88,17 +87,18 @@ RUN npm install -g pnpm && \ fi # Copy built assets from the base stage -COPY --from=base /app ./ -# COPY --from=base /app/public ./public -# COPY --from=base /app/next.config.js ./next.config.js -# COPY --from=base /app/components ./components -# COPY --from=base /app/context ./context -# COPY --from=base /app/lib ./lib -# COPY --from=base /app/translation ./translation -# COPY --from=base /app/utils ./utils -# COPY --from=base /app/middleware.ts ./middleware.ts -# COPY --from=base /app/auth.ts ./auth.ts -# COPY --from=base /app/components.json ./components.json +# COPY --from=base /app ./ +COPY --from=base /app/.next ./.next +COPY --from=base /app/public ./public +COPY --from=base /app/next.config.js ./next.config.js +COPY --from=base /app/components ./components +COPY --from=base /app/context ./context +COPY --from=base /app/lib ./lib +COPY --from=base /app/translation ./translation +COPY --from=base /app/utils ./utils +COPY --from=base /app/middleware.ts ./middleware.ts +COPY --from=base /app/auth.ts ./auth.ts +COPY --from=base /app/components.json ./components.json # Expose the port the app runs on EXPOSE 3000 diff --git a/nginx/templates/nginx.conf b/nginx/templates/nginx.conf index ded6d20d3..0f87d6c4a 100644 --- a/nginx/templates/nginx.conf +++ b/nginx/templates/nginx.conf @@ -13,4 +13,21 @@ server { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } +} + +server { + listen 8000; + server_name localhost; + + location / { + proxy_pass http://172.20.3.26:8000; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection 'upgrade'; + proxy_set_header Host $host; + proxy_cache_bypass $http_upgrade; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } } \ No newline at end of file