Add Dockerfile and fix pnpm setup for Dokploy

This commit is contained in:
Mackie 2026-05-22 01:45:11 +08:00
parent 23477e7a2d
commit 35d75607b0
6 changed files with 10995 additions and 114 deletions

View file

@ -1,71 +1,25 @@
# To use this Dockerfile, you have to set `output: 'standalone'` in your next.config.js file.
# From https://github.com/vercel/next.js/blob/canary/examples/with-docker/Dockerfile
FROM node:22.17.0-alpine AS base
# Install dependencies only when needed
FROM base AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
WORKDIR /app
# Install dependencies based on the preferred package manager
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./
RUN \
if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
elif [ -f package-lock.json ]; then npm ci; \
elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm i --frozen-lockfile; \
elif [ -f pnpm-lock.yaml ]; then corepack enable && corepack prepare pnpm@10.11.0 --activate && pnpm i --frozen-lockfile; \
else echo "Lockfile not found." && exit 1; \
fi
# Rebuild the source code only when needed
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
# Next.js collects completely anonymous telemetry data about general usage.
# Learn more here: https://nextjs.org/telemetry
# Uncomment the following line in case you want to disable telemetry during the build.
# ENV NEXT_TELEMETRY_DISABLED 1
RUN \
if [ -f yarn.lock ]; then yarn run build; \
elif [ -f package-lock.json ]; then npm run build; \
elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm run build; \
elif [ -f pnpm-lock.yaml ]; then corepack enable && corepack prepare pnpm@10.11.0 --activate && pnpm run build; \
else echo "Lockfile not found." && exit 1; \
fi
# Production image, copy all the files and run next
FROM base AS runner
WORKDIR /app
ENV NODE_ENV production
# Uncomment the following line in case you want to disable telemetry during runtime.
# ENV NEXT_TELEMETRY_DISABLED 1
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
# Remove this line if you do not have this folder
COPY --from=builder /app/public ./public
# Set the correct permission for prerender cache
RUN mkdir .next
RUN chown nextjs:nodejs .next
# Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
USER nextjs
EXPOSE 3000
ENV PORT 3000
# server.js is created by next build from the standalone output
# https://nextjs.org/docs/pages/api-reference/next-config-js/output
CMD HOSTNAME="0.0.0.0" node server.js

0
payload_dump.sql Normal file
View file

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

9
src/migrations/index.ts Normal file
View file

@ -0,0 +1,9 @@
import * as migration_20260521_173007 from './20260521_173007';
export const migrations = [
{
up: migration_20260521_173007.up,
down: migration_20260521_173007.down,
name: '20260521_173007'
},
];

View file

@ -106,7 +106,7 @@ export interface Config {
'payload-migrations': PayloadMigrationsSelect<false> | PayloadMigrationsSelect<true>;
};
db: {
defaultIDType: string;
defaultIDType: number;
};
fallbackLocale: null;
globals: {
@ -156,7 +156,7 @@ export interface UserAuthOperations {
* via the `definition` "pages".
*/
export interface Page {
id: string;
id: number;
title: string;
hero: {
type: 'none' | 'highImpact' | 'mediumImpact' | 'lowImpact';
@ -183,11 +183,11 @@ export interface Page {
reference?:
| ({
relationTo: 'pages';
value: string | Page;
value: number | Page;
} | null)
| ({
relationTo: 'posts';
value: string | Post;
value: number | Post;
} | null);
url?: string | null;
label: string;
@ -199,7 +199,7 @@ export interface Page {
id?: string | null;
}[]
| null;
media?: (string | null) | Media;
media?: (number | null) | Media;
};
layout: (CallToActionBlock | ContentBlock | MediaBlock | ArchiveBlock | FormBlock)[];
meta?: {
@ -207,7 +207,7 @@ export interface Page {
/**
* Maximum upload file size: 12MB. Recommended file size for images is <500KB.
*/
image?: (string | null) | Media;
image?: (number | null) | Media;
description?: string | null;
};
publishedAt?: string | null;
@ -225,9 +225,9 @@ export interface Page {
* via the `definition` "posts".
*/
export interface Post {
id: string;
id: number;
title: string;
heroImage?: (string | null) | Media;
heroImage?: (number | null) | Media;
content: {
root: {
type: string;
@ -243,18 +243,18 @@ export interface Post {
};
[k: string]: unknown;
};
relatedPosts?: (string | Post)[] | null;
categories?: (string | Category)[] | null;
relatedPosts?: (number | Post)[] | null;
categories?: (number | Category)[] | null;
meta?: {
title?: string | null;
/**
* Maximum upload file size: 12MB. Recommended file size for images is <500KB.
*/
image?: (string | null) | Media;
image?: (number | null) | Media;
description?: string | null;
};
publishedAt?: string | null;
authors?: (string | User)[] | null;
authors?: (number | User)[] | null;
populatedAuthors?:
| {
id?: string | null;
@ -275,7 +275,7 @@ export interface Post {
* via the `definition` "media".
*/
export interface Media {
id: string;
id: number;
alt?: string | null;
caption?: {
root: {
@ -292,7 +292,7 @@ export interface Media {
};
[k: string]: unknown;
} | null;
folder?: (string | null) | FolderInterface;
folder?: (number | null) | FolderInterface;
updatedAt: string;
createdAt: string;
url?: string | null;
@ -368,18 +368,18 @@ export interface Media {
* via the `definition` "payload-folders".
*/
export interface FolderInterface {
id: string;
id: number;
name: string;
folder?: (string | null) | FolderInterface;
folder?: (number | null) | FolderInterface;
documentsAndFolders?: {
docs?: (
| {
relationTo?: 'payload-folders';
value: string | FolderInterface;
value: number | FolderInterface;
}
| {
relationTo?: 'media';
value: string | Media;
value: number | Media;
}
)[];
hasNextPage?: boolean;
@ -394,17 +394,17 @@ export interface FolderInterface {
* via the `definition` "categories".
*/
export interface Category {
id: string;
id: number;
title: string;
/**
* When enabled, the slug will auto-generate from the title field on save and autosave.
*/
generateSlug?: boolean | null;
slug: string;
parent?: (string | null) | Category;
parent?: (number | null) | Category;
breadcrumbs?:
| {
doc?: (string | null) | Category;
doc?: (number | null) | Category;
url?: string | null;
label?: string | null;
id?: string | null;
@ -418,7 +418,7 @@ export interface Category {
* via the `definition` "users".
*/
export interface User {
id: string;
id: number;
name?: string | null;
updatedAt: string;
createdAt: string;
@ -467,11 +467,11 @@ export interface CallToActionBlock {
reference?:
| ({
relationTo: 'pages';
value: string | Page;
value: number | Page;
} | null)
| ({
relationTo: 'posts';
value: string | Post;
value: number | Post;
} | null);
url?: string | null;
label: string;
@ -517,11 +517,11 @@ export interface ContentBlock {
reference?:
| ({
relationTo: 'pages';
value: string | Page;
value: number | Page;
} | null)
| ({
relationTo: 'posts';
value: string | Post;
value: number | Post;
} | null);
url?: string | null;
label: string;
@ -542,7 +542,7 @@ export interface ContentBlock {
* via the `definition` "MediaBlock".
*/
export interface MediaBlock {
media: string | Media;
media: number | Media;
id?: string | null;
blockName?: string | null;
blockType: 'mediaBlock';
@ -569,12 +569,12 @@ export interface ArchiveBlock {
} | null;
populateBy?: ('collection' | 'selection') | null;
relationTo?: 'posts' | null;
categories?: (string | Category)[] | null;
categories?: (number | Category)[] | null;
limit?: number | null;
selectedDocs?:
| {
relationTo: 'posts';
value: string | Post;
value: number | Post;
}[]
| null;
id?: string | null;
@ -586,7 +586,7 @@ export interface ArchiveBlock {
* via the `definition` "FormBlock".
*/
export interface FormBlock {
form: string | Form;
form: number | Form;
enableIntro?: boolean | null;
introContent?: {
root: {
@ -612,7 +612,7 @@ export interface FormBlock {
* via the `definition` "forms".
*/
export interface Form {
id: string;
id: number;
title: string;
fields?:
| (
@ -786,7 +786,7 @@ export interface Form {
* via the `definition` "redirects".
*/
export interface Redirect {
id: string;
id: number;
/**
* You will need to rebuild the website when changing this field.
*/
@ -796,11 +796,11 @@ export interface Redirect {
reference?:
| ({
relationTo: 'pages';
value: string | Page;
value: number | Page;
} | null)
| ({
relationTo: 'posts';
value: string | Post;
value: number | Post;
} | null);
url?: string | null;
};
@ -812,8 +812,8 @@ export interface Redirect {
* via the `definition` "form-submissions".
*/
export interface FormSubmission {
id: string;
form: string | Form;
id: number;
form: number | Form;
submissionData?:
| {
field: string;
@ -831,18 +831,18 @@ export interface FormSubmission {
* via the `definition` "search".
*/
export interface Search {
id: string;
id: number;
title?: string | null;
priority?: number | null;
doc: {
relationTo: 'posts';
value: string | Post;
value: number | Post;
};
slug?: string | null;
meta?: {
title?: string | null;
description?: string | null;
image?: (string | null) | Media;
image?: (number | null) | Media;
};
categories?:
| {
@ -860,7 +860,7 @@ export interface Search {
* via the `definition` "payload-kv".
*/
export interface PayloadKv {
id: string;
id: number;
key: string;
data:
| {
@ -877,7 +877,7 @@ export interface PayloadKv {
* via the `definition` "payload-jobs".
*/
export interface PayloadJob {
id: string;
id: number;
/**
* Input data provided to the job
*/
@ -969,52 +969,52 @@ export interface PayloadJob {
* via the `definition` "payload-locked-documents".
*/
export interface PayloadLockedDocument {
id: string;
id: number;
document?:
| ({
relationTo: 'pages';
value: string | Page;
value: number | Page;
} | null)
| ({
relationTo: 'posts';
value: string | Post;
value: number | Post;
} | null)
| ({
relationTo: 'media';
value: string | Media;
value: number | Media;
} | null)
| ({
relationTo: 'categories';
value: string | Category;
value: number | Category;
} | null)
| ({
relationTo: 'users';
value: string | User;
value: number | User;
} | null)
| ({
relationTo: 'redirects';
value: string | Redirect;
value: number | Redirect;
} | null)
| ({
relationTo: 'forms';
value: string | Form;
value: number | Form;
} | null)
| ({
relationTo: 'form-submissions';
value: string | FormSubmission;
value: number | FormSubmission;
} | null)
| ({
relationTo: 'search';
value: string | Search;
value: number | Search;
} | null)
| ({
relationTo: 'payload-folders';
value: string | FolderInterface;
value: number | FolderInterface;
} | null);
globalSlug?: string | null;
user: {
relationTo: 'users';
value: string | User;
value: number | User;
};
updatedAt: string;
createdAt: string;
@ -1024,10 +1024,10 @@ export interface PayloadLockedDocument {
* via the `definition` "payload-preferences".
*/
export interface PayloadPreference {
id: string;
id: number;
user: {
relationTo: 'users';
value: string | User;
value: number | User;
};
key?: string | null;
value?:
@ -1047,7 +1047,7 @@ export interface PayloadPreference {
* via the `definition` "payload-migrations".
*/
export interface PayloadMigration {
id: string;
id: number;
name?: string | null;
batch?: number | null;
updatedAt: string;
@ -1636,7 +1636,7 @@ export interface PayloadMigrationsSelect<T extends boolean = true> {
* via the `definition` "header".
*/
export interface Header {
id: string;
id: number;
navItems?:
| {
link: {
@ -1645,11 +1645,11 @@ export interface Header {
reference?:
| ({
relationTo: 'pages';
value: string | Page;
value: number | Page;
} | null)
| ({
relationTo: 'posts';
value: string | Post;
value: number | Post;
} | null);
url?: string | null;
label: string;
@ -1665,7 +1665,7 @@ export interface Header {
* via the `definition` "footer".
*/
export interface Footer {
id: string;
id: number;
navItems?:
| {
link: {
@ -1674,11 +1674,11 @@ export interface Footer {
reference?:
| ({
relationTo: 'pages';
value: string | Page;
value: number | Page;
} | null)
| ({
relationTo: 'posts';
value: string | Post;
value: number | Post;
} | null);
url?: string | null;
label: string;
@ -1756,14 +1756,14 @@ export interface TaskSchedulePublish {
doc?:
| ({
relationTo: 'pages';
value: string | Page;
value: number | Page;
} | null)
| ({
relationTo: 'posts';
value: string | Post;
value: number | Post;
} | null);
global?: string | null;
user?: (string | null) | User;
user?: (number | null) | User;
};
output?: unknown;
}