Skip to content

Commit

Permalink
fixup! feat(DEV-10495): add image build task
Browse files Browse the repository at this point in the history
  • Loading branch information
radist2s committed Jul 4, 2024
1 parent 963400b commit 4aeecdd
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pull-preview-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
"monite_project_client_secret=${{ secrets.PULL_PREVIEW_MONITE_PROJECT_CLIENT_SECRET_DEV }}"
"monite_project_client_id=${{ secrets.PULL_PREVIEW_MONITE_PROJECT_CLIENT_ID_DEV }}"
build-args: |
NEXT_PUBLIC_CLERK_DOMAIN=${{ vars.PULL_PREVIEW_CLERK_DOMAIN_DEV }}
APP_SIGN_IN_URL=https://${{ vars.PULL_PREVIEW_CLERK_DOMAIN_DEV }}/sign-in
TURBO_API=http://${{ env.turbo_api_ip }}:41230
TURBO_TEAM=turbogha
TURBO_TOKEN=turbogha
Expand Down
4 changes: 4 additions & 0 deletions SdkDemoWithNextjsAndClerkAuth.PullPreviewDeploy.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ ARG TURBO_TEAM
ARG TURBO_TOKEN
ARG NEXT_PUBLIC_CLERK_IS_SATELLITE=true
ARG NEXT_PUBLIC_CLERK_DOMAIN
ARG APP_SIGN_IN_URL

RUN yarn build --filter='sdk-demo-with-nextjs-and-clerk-auth'

Expand All @@ -32,5 +33,8 @@ RUN --mount=type=secret,id=monite_project_client_id \
RUN --mount=type=secret,id=monite_project_client_secret \
echo "MONITE_PROJECT_CLIENT_SECRET=$(cat /run/secrets/monite_project_client_secret)" >> examples/with-nextjs-and-clerk-auth/.env.local

# Must be main domain Sign In URL, not the satellite one
RUN echo "APP_SIGN_IN_URL=$APP_SIGN_IN_URL" >> examples/with-nextjs-and-clerk-auth/.env.local

CMD ["yarn", "workspace", "sdk-demo-with-nextjs-and-clerk-auth", "run", "start"]
EXPOSE 3000
1 change: 1 addition & 0 deletions docker-compose.pull-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ services:
image: "${PREVIEW_SDK_DEMO_WITH_NEXTJS_AND_CLERK_AUTH_IMAGE}"
environment:
MONITE_API_URL: "https://api.dev.monite.com/v1"
CLERK_SATELLITE_APP_DOMAIN: "${PULLPREVIEW_PUBLIC_DNS}"
6 changes: 5 additions & 1 deletion examples/with-nextjs-and-clerk-auth/src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ export default async function RootLayout({
const selectedTheme = getSelectedTheme(user);

return (
<ClerkProvider publishableKey={process.env.CLERK_PUBLISHABLE_KEY}>
<ClerkProvider
publishableKey={process.env.CLERK_PUBLISHABLE_KEY}
signInUrl={process.env.APP_SIGN_IN_URL}
domain={process.env.CLERK_SATELLITE_APP_DOMAIN}
>
<MultisessionAppSupport>
<html lang="en">
<body className={themeFont.className}>
Expand Down
9 changes: 9 additions & 0 deletions examples/with-nextjs-and-clerk-auth/src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,18 @@ import { authMiddleware as createAuthMiddleware } from '@clerk/nextjs';
// Please edit this to allow other routes to be public as needed.
// See https://clerk.com/docs/references/nextjs/auth-middleware for more information about configuring your middleware

const authMiddlewareDomainOptions = process.env.CLERK_SATELLITE_APP_DOMAIN
? {
domain: process.env.CLERK_SATELLITE_APP_DOMAIN,
}
: undefined;

const authMiddleware = createAuthMiddleware({
publicRoutes: ['/api/in/clerk', '/api/healthcheck', '/public'],
// @ts-expect-error - An issue with Clerk's types
publishableKey: process.env.CLERK_PUBLISHABLE_KEY,
signInUrl: process.env.APP_SIGN_IN_URL, // main domain SignIn URL, not satellite
...authMiddlewareDomainOptions,
});

const authMiddlewareNo401Response: NextMiddleware = async (request, event) => {
Expand Down

0 comments on commit 4aeecdd

Please sign in to comment.