fix config for docker and import in getServerSideProps
This commit is contained in:
parent
19379d3cf0
commit
36d83fceec
|
|
@ -18,17 +18,17 @@ RUN \
|
|||
##### BUILDER
|
||||
|
||||
FROM --platform=linux/amd64 node:16-alpine3.17 AS builder
|
||||
ARG PB_API
|
||||
WORKDIR /app
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY . .
|
||||
|
||||
ENV NEXT_TELEMETRY_DISABLED 1
|
||||
ENV SKIP_ENV_VALIDATION 1
|
||||
|
||||
RUN \
|
||||
if [ -f yarn.lock ]; then SKIP_ENV_VALIDATION=1 yarn build; \
|
||||
elif [ -f package-lock.json ]; then SKIP_ENV_VALIDATION=1 npm run build; \
|
||||
elif [ -f pnpm-lock.yaml ]; then yarn global add pnpm && SKIP_ENV_VALIDATION=1 pnpm run build; \
|
||||
if [ -f yarn.lock ]; then yarn build; \
|
||||
elif [ -f package-lock.json ]; then npm run build; \
|
||||
elif [ -f pnpm-lock.yaml ]; then yarn global add pnpm && pnpm run build; \
|
||||
else echo "Lockfile not found." && exit 1; \
|
||||
fi
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import Layout from "@/layouts/Home"
|
||||
import { getPages } from "@/utils/pb"
|
||||
import type { PagesRecord } from "@/@types/pocketbase-types"
|
||||
|
||||
export default function Test({ json }: { json: PagesRecord[]}) {
|
||||
|
|
@ -18,6 +17,7 @@ export default function Test({ json }: { json: PagesRecord[]}) {
|
|||
}
|
||||
|
||||
export async function getServerSideProps() {
|
||||
const { getPages } = await import("@/utils/pb")
|
||||
|
||||
const {data, error} = await getPages();
|
||||
if (error || !data) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import type { PagesRecord } from '@/@types/pocketbase-types';
|
||||
import Layout from '@/layouts/Home'
|
||||
import { getPageBySlug } from '@/utils/pb'
|
||||
|
||||
function parseBoldText(text: string) {
|
||||
const parts = text.split(/(<b>.*?<\/b>)/g);
|
||||
|
|
@ -86,6 +85,7 @@ export default function Page({ data }: { slug: string, data: PagesRecord<Content
|
|||
}
|
||||
|
||||
export async function getServerSideProps({ params }: { params: { slug: string } }) {
|
||||
const { getPageBySlug } = await import("@/utils/pb");
|
||||
const { data, error } = await getPageBySlug(params.slug);
|
||||
if (error || !data) {
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import type { PagesRecord } from "@/@types/pocketbase-types";
|
||||
import { getPages } from "@/utils/pb";
|
||||
import Layout from "@/layouts/Home";
|
||||
|
||||
export default function ListPages({ data }: { data: PagesRecord[] }) {
|
||||
|
|
@ -22,6 +21,7 @@ export default function ListPages({ data }: { data: PagesRecord[] }) {
|
|||
}
|
||||
|
||||
export async function getServerSideProps() {
|
||||
const { getPages } = await import("@/utils/pb");
|
||||
const { data, error } = await getPages();
|
||||
if (error || !data) {
|
||||
return {
|
||||
|
|
|
|||
Loading…
Reference in New Issue