27
payload/Dockerfile
Normal file
27
payload/Dockerfile
Normal file
@ -0,0 +1,27 @@
|
||||
FROM node:lts-alpine as base
|
||||
WORKDIR /base
|
||||
COPY ./package.json ./package.json
|
||||
RUN yarn install
|
||||
COPY ./ ./
|
||||
|
||||
FROM base AS dev
|
||||
ENV NODE_ENV=development
|
||||
EXPOSE 3001
|
||||
CMD ["yarn","dev"]
|
||||
|
||||
|
||||
FROM base AS build
|
||||
ENV NODE_ENV=production
|
||||
WORKDIR /build
|
||||
COPY --from=base /base ./
|
||||
RUN yarn build
|
||||
|
||||
FROM build as prod
|
||||
ENV NODE_ENV=production
|
||||
WORKDIR /prod
|
||||
COPY package.json ./
|
||||
RUN yarn install --production
|
||||
COPY --from=buil /build/dist ./dist
|
||||
COPY --from=buil /build/build ./build
|
||||
EXPOSE 3000
|
||||
CMD ["node", "dist/server.js"]
|
@ -1,4 +1,4 @@
|
||||
{
|
||||
"ext": "ts",
|
||||
"exec": "ts-node src/server.ts"
|
||||
"exec": "yarn generate:types && ts-node src/server.ts"
|
||||
}
|
||||
|
@ -1,62 +1,62 @@
|
||||
import { CollectionConfig } from 'payload/types';
|
||||
import { CollectionConfig } from "payload/types";
|
||||
|
||||
const Posts: CollectionConfig = {
|
||||
slug: 'posts',
|
||||
slug: "posts",
|
||||
admin: {
|
||||
defaultColumns: ['title', 'author', 'category', 'tags', 'status'],
|
||||
useAsTitle: 'title',
|
||||
defaultColumns: ["title", "author", "category", "tags", "status"],
|
||||
useAsTitle: "title",
|
||||
},
|
||||
access: {
|
||||
read: () => true,
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
name: 'title',
|
||||
type: 'text',
|
||||
name: "title",
|
||||
type: "text",
|
||||
},
|
||||
{
|
||||
name: 'author',
|
||||
type: 'relationship',
|
||||
relationTo: 'users',
|
||||
name: "author",
|
||||
type: "relationship",
|
||||
relationTo: "users",
|
||||
},
|
||||
{
|
||||
name: 'publishedDate',
|
||||
type: 'date',
|
||||
name: "publishedDate",
|
||||
type: "date",
|
||||
},
|
||||
{
|
||||
name: 'category',
|
||||
type: 'relationship',
|
||||
relationTo: 'categories'
|
||||
name: "category",
|
||||
type: "relationship",
|
||||
relationTo: "categories",
|
||||
},
|
||||
{
|
||||
name: 'tags',
|
||||
type: 'relationship',
|
||||
relationTo: 'tags',
|
||||
name: "tags",
|
||||
type: "relationship",
|
||||
relationTo: "tags",
|
||||
hasMany: true,
|
||||
},
|
||||
{
|
||||
name: 'content',
|
||||
type: 'richText'
|
||||
name: "content",
|
||||
type: "richText",
|
||||
},
|
||||
{
|
||||
name: 'status',
|
||||
type: 'select',
|
||||
name: "status",
|
||||
type: "select",
|
||||
options: [
|
||||
{
|
||||
value: 'draft',
|
||||
label: 'Draft',
|
||||
value: "draft",
|
||||
label: "Draft",
|
||||
},
|
||||
{
|
||||
value: 'published',
|
||||
label: 'Published',
|
||||
value: "published",
|
||||
label: "Published",
|
||||
},
|
||||
],
|
||||
defaultValue: 'draft',
|
||||
defaultValue: "draft",
|
||||
admin: {
|
||||
position: 'sidebar',
|
||||
}
|
||||
}
|
||||
position: "sidebar",
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
};
|
||||
|
||||
export default Posts;
|
||||
export default Posts;
|
||||
|
@ -12,6 +12,6 @@ export default buildConfig({
|
||||
},
|
||||
collections: [Categories, Posts, Tags, Users],
|
||||
typescript: {
|
||||
outputFile: path.resolve("../", "types.ts"),
|
||||
outputFile: path.resolve("/", "types.ts"),
|
||||
},
|
||||
});
|
||||
|
Reference in New Issue
Block a user