Add Docker Registry AIO with Nuxt Token Auth and admin UI.
Compose brings up registry:3 plus a Prisma/SQLite Nuxt app for docker login, ACL management, and image browsing with shadcn-vue. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
commit
0fd00bfa37
120 files changed
+17094
No files matched your search
@@ -0,0 +1,27 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE "User" (
|
||||
"id" TEXT NOT NULL PRIMARY KEY,
|
||||
"username" TEXT NOT NULL,
|
||||
"passwordHash" TEXT NOT NULL,
|
||||
"role" TEXT NOT NULL DEFAULT 'USER',
|
||||
"active" BOOLEAN NOT NULL DEFAULT true,
|
||||
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" DATETIME NOT NULL
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "Acl" (
|
||||
"id" TEXT NOT NULL PRIMARY KEY,
|
||||
"userId" TEXT NOT NULL,
|
||||
"repository" TEXT NOT NULL,
|
||||
"canPull" BOOLEAN NOT NULL DEFAULT true,
|
||||
"canPush" BOOLEAN NOT NULL DEFAULT false,
|
||||
"canDelete" BOOLEAN NOT NULL DEFAULT false,
|
||||
CONSTRAINT "Acl_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE CASCADE ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "User_username_key" ON "User"("username");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "Acl_userId_idx" ON "Acl"("userId");
|
||||
@@ -0,0 +1,3 @@
|
||||
# Please do not edit this file manually
|
||||
# It should be added in your version-control system (e.g., Git)
|
||||
provider = "sqlite"
|
||||
@@ -0,0 +1,36 @@
|
||||
generator client {
|
||||
provider = "prisma-client"
|
||||
output = "../generated/prisma"
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "sqlite"
|
||||
}
|
||||
|
||||
enum Role {
|
||||
ADMIN
|
||||
USER
|
||||
}
|
||||
|
||||
model User {
|
||||
id String @id @default(cuid())
|
||||
username String @unique
|
||||
passwordHash String
|
||||
role Role @default(USER)
|
||||
active Boolean @default(true)
|
||||
acls Acl[]
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
}
|
||||
|
||||
model Acl {
|
||||
id String @id @default(cuid())
|
||||
userId String
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
repository String
|
||||
canPull Boolean @default(true)
|
||||
canPush Boolean @default(false)
|
||||
canDelete Boolean @default(false)
|
||||
|
||||
@@index([userId])
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
import type { PrismaClient } from '../../generated/prisma/client'
|
||||
import { hashPassword } from '../server/utils/password'
|
||||
|
||||
type SeedPrisma = Pick<PrismaClient, 'user'>
|
||||
|
||||
export async function seedAdmin(prisma: SeedPrisma) {
|
||||
const username = process.env.ADMIN_USERNAME || 'admin'
|
||||
const password = process.env.ADMIN_PASSWORD || 'admin123'
|
||||
|
||||
const existing = await prisma.user.findUnique({ where: { username } })
|
||||
if (existing) {
|
||||
return existing
|
||||
}
|
||||
|
||||
return prisma.user.create({
|
||||
data: {
|
||||
username,
|
||||
passwordHash: await hashPassword(password),
|
||||
role: 'ADMIN',
|
||||
active: true,
|
||||
},
|
||||
})
|
||||
}
|
||||
Reference in new issue
Block a user