feat: add EncryptID SDK and AuthProvider
SDK added as dependency, AuthProvider wraps layout, Dockerfile updated for parent context build with SDK copy. No auth guards needed (GET-only routes). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
3f9ce76ca2
commit
6ab52b72f7
17
Dockerfile
17
Dockerfile
|
|
@ -1,20 +1,23 @@
|
||||||
FROM node:20-alpine AS base
|
FROM node:20-alpine AS base
|
||||||
|
|
||||||
# Install pnpm
|
|
||||||
RUN corepack enable && corepack prepare pnpm@latest --activate
|
|
||||||
|
|
||||||
# Dependencies stage
|
# Dependencies stage
|
||||||
FROM base AS deps
|
FROM base AS deps
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY package.json pnpm-lock.yaml* package-lock.json* ./
|
COPY rtube-online/package.json rtube-online/package-lock.json* ./
|
||||||
RUN if [ -f pnpm-lock.yaml ]; then pnpm install --frozen-lockfile; else npm install; fi
|
# Copy local SDK dependency
|
||||||
|
COPY encryptid-sdk /encryptid-sdk/
|
||||||
|
RUN npm ci || npm install
|
||||||
|
|
||||||
|
# Ensure SDK is properly linked in node_modules
|
||||||
|
RUN rm -rf node_modules/@encryptid/sdk && \
|
||||||
|
mkdir -p node_modules/@encryptid && \
|
||||||
|
cp -r /encryptid-sdk node_modules/@encryptid/sdk
|
||||||
|
|
||||||
# Build stage
|
# Build stage
|
||||||
FROM base AS builder
|
FROM base AS builder
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY . .
|
|
||||||
RUN rm -rf node_modules .next
|
|
||||||
COPY --from=deps /app/node_modules ./node_modules
|
COPY --from=deps /app/node_modules ./node_modules
|
||||||
|
COPY rtube-online/ .
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
# Production stage
|
# Production stage
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import type { Metadata } from 'next'
|
import type { Metadata } from 'next'
|
||||||
import localFont from 'next/font/local'
|
import localFont from 'next/font/local'
|
||||||
import './globals.css'
|
import './globals.css'
|
||||||
|
import { AuthProvider } from '@/components/AuthProvider'
|
||||||
|
|
||||||
const geistSans = localFont({
|
const geistSans = localFont({
|
||||||
src: './fonts/GeistVF.woff',
|
src: './fonts/GeistVF.woff',
|
||||||
|
|
@ -32,7 +33,9 @@ export default function RootLayout({
|
||||||
return (
|
return (
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<body className={`${geistSans.variable} ${geistMono.variable} antialiased`}>
|
<body className={`${geistSans.variable} ${geistMono.variable} antialiased`}>
|
||||||
{children}
|
<AuthProvider>
|
||||||
|
{children}
|
||||||
|
</AuthProvider>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
'use client';
|
||||||
|
|
||||||
|
import { EncryptIDProvider } from '@encryptid/sdk/ui/react';
|
||||||
|
|
||||||
|
export function AuthProvider({ children }: { children: React.ReactNode }) {
|
||||||
|
const Provider = EncryptIDProvider as any;
|
||||||
|
return (
|
||||||
|
<Provider serverUrl={process.env.NEXT_PUBLIC_ENCRYPTID_SERVER_URL}>
|
||||||
|
{children}
|
||||||
|
</Provider>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -1,11 +1,12 @@
|
||||||
services:
|
services:
|
||||||
rtube:
|
rtube:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: ..
|
||||||
dockerfile: Dockerfile
|
dockerfile: rtube-online/Dockerfile
|
||||||
container_name: rtube
|
container_name: rtube
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
environment:
|
environment:
|
||||||
|
- NEXT_PUBLIC_ENCRYPTID_SERVER_URL=${NEXT_PUBLIC_ENCRYPTID_SERVER_URL:-https://encryptid.jeffemmett.com}
|
||||||
- R2_ENDPOINT=${R2_ENDPOINT}
|
- R2_ENDPOINT=${R2_ENDPOINT}
|
||||||
- R2_BUCKET=${R2_BUCKET:-rtube-videos}
|
- R2_BUCKET=${R2_BUCKET:-rtube-videos}
|
||||||
- R2_ACCESS_KEY_ID=${R2_ACCESS_KEY_ID}
|
- R2_ACCESS_KEY_ID=${R2_ACCESS_KEY_ID}
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@aws-sdk/client-s3": "^3.700.0",
|
"@aws-sdk/client-s3": "^3.700.0",
|
||||||
|
"@encryptid/sdk": "file:../encryptid-sdk",
|
||||||
"hls.js": "^1.5.0",
|
"hls.js": "^1.5.0",
|
||||||
"next": "14.2.35",
|
"next": "14.2.35",
|
||||||
"react": "^18",
|
"react": "^18",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue