From 12f829c3d32e4f5da5112a722b3d78d40117adcb Mon Sep 17 00:00:00 2001 From: kjuulh Date: Sun, 6 Nov 2022 23:17:51 +0100 Subject: [PATCH] standalone is not ready yet --- Dockerfile | 7 ++----- app/blog/page.tsx | 12 ++++++++++++ app/blog/posts.tsx | 30 ++++++++++++++++++++++++++++++ app/page.tsx | 7 +++++-- app/posts.tsx | 6 ++---- next.config.js | 1 - package.json | 2 +- yarn.lock | 2 +- 8 files changed, 53 insertions(+), 14 deletions(-) create mode 100644 app/blog/page.tsx create mode 100644 app/blog/posts.tsx diff --git a/Dockerfile b/Dockerfile index 0d66bd7..aebb6d2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -41,12 +41,9 @@ RUN adduser --system --uid 1001 nextjs COPY --from=git-log --chown=nextjs:nodejs /usr/bin/git-log /usr/bin/git-log -COPY --from=builder /app/public ./public - # 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 +COPY --from=builder --chown=nextjs:nodejs /app/ ./ USER nextjs @@ -54,4 +51,4 @@ EXPOSE 3000 ENV PORT 3000 -CMD ["node", "server.js"] +CMD ["yarn", "start"] diff --git a/app/blog/page.tsx b/app/blog/page.tsx new file mode 100644 index 0000000..0403c3a --- /dev/null +++ b/app/blog/page.tsx @@ -0,0 +1,12 @@ +import { Suspense } from 'react'; +import Posts from './posts'; + +export default function Page() { + return ( +
+ Loading...
}> + + + + ); +} diff --git a/app/blog/posts.tsx b/app/blog/posts.tsx new file mode 100644 index 0000000..f77d43c --- /dev/null +++ b/app/blog/posts.tsx @@ -0,0 +1,30 @@ +import { getPosts } from '@/lib/getPosts'; +import { cookies } from 'next/headers'; +import { use } from 'react'; +import ReactMarkdown from 'react-markdown'; +import remarkGfm from 'remark-gfm'; + +export default function Posts() { + const c = cookies(); + + const posts = use(getPosts()); + + return ( + <> + {posts.map((p) => ( +
+

@{p.author.name}

+

{p.title}

+
+ {p.message && ( + + )} +
+ + {new Date(p.time * 1000).toLocaleString()} + +
+ ))} + + ); +} diff --git a/app/page.tsx b/app/page.tsx index 1e0e06e..0403c3a 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -1,9 +1,12 @@ +import { Suspense } from 'react'; import Posts from './posts'; -export default async function Page() { +export default function Page() { return (
- + Loading...
}> + + ); } diff --git a/app/posts.tsx b/app/posts.tsx index 5f3bba3..f77d43c 100644 --- a/app/posts.tsx +++ b/app/posts.tsx @@ -4,7 +4,7 @@ import { use } from 'react'; import ReactMarkdown from 'react-markdown'; import remarkGfm from 'remark-gfm'; -const Posts = () => { +export default function Posts() { const c = cookies(); const posts = use(getPosts()); @@ -27,6 +27,4 @@ const Posts = () => { ))} ); -}; - -export default Posts; +} diff --git a/next.config.js b/next.config.js index 92e3ca9..593a397 100755 --- a/next.config.js +++ b/next.config.js @@ -2,7 +2,6 @@ const nextConfig = { reactStrictMode: true, // Recommended for the `pages` directory, default in `app`. swcMinify: true, - output: 'standalone', experimental: { // Required: appDir: true, diff --git a/package.json b/package.json index 2a184e9..50ef37b 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "dependencies": { "clsx": "1.2.1", "concurrently": "7.5.0", - "next": "latest", + "next": "13.0.2", "react": "18.2.0", "react-dom": "18.2.0", "react-markdown": "8.0.3", diff --git a/yarn.lock b/yarn.lock index 7c29255..5af81db 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3113,7 +3113,7 @@ natural-compare@^1.4.0: resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw== -next@latest: +next@13.0.2: version "13.0.2" resolved "https://registry.yarnpkg.com/next/-/next-13.0.2.tgz#b8c8642c70f736ed91105645391d335fc51c8f62" integrity sha512-uQ5z5e4D9mOe8+upy6bQdYYjo/kk1v3jMW87kTy2TgAyAsEO+CkwRnMgyZ4JoHEnhPZLHwh7dk0XymRNLe1gFw==