standalone is not ready yet
Some checks reported errors
continuous-integration/drone/push Build was killed

This commit is contained in:
Kasper Juul Hermansen 2022-11-06 23:17:51 +01:00
parent 3ac968a63c
commit 12f829c3d3
Signed by: kjuulh
GPG Key ID: 0F95C140730F2F23
8 changed files with 53 additions and 14 deletions

View File

@ -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=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 # Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing # 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/ ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
USER nextjs USER nextjs
@ -54,4 +51,4 @@ EXPOSE 3000
ENV PORT 3000 ENV PORT 3000
CMD ["node", "server.js"] CMD ["yarn", "start"]

12
app/blog/page.tsx Normal file
View File

@ -0,0 +1,12 @@
import { Suspense } from 'react';
import Posts from './posts';
export default function Page() {
return (
<div className="space-y-6 pt-6">
<Suspense fallback={<div>Loading...</div>}>
<Posts />
</Suspense>
</div>
);
}

30
app/blog/posts.tsx Normal file
View File

@ -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) => (
<div className="space-y-2 rounded-md border border-solid border-gray-700 p-4 text-white">
<p className="font-bold">@{p.author.name}</p>
<p className="italic">{p.title}</p>
<div className="markdown">
{p.message && (
<ReactMarkdown children={p.message} remarkPlugins={[remarkGfm]} />
)}
</div>
<small className="mt-2">
{new Date(p.time * 1000).toLocaleString()}
</small>
</div>
))}
</>
);
}

View File

@ -1,9 +1,12 @@
import { Suspense } from 'react';
import Posts from './posts'; import Posts from './posts';
export default async function Page() { export default function Page() {
return ( return (
<div className="space-y-6 pt-6"> <div className="space-y-6 pt-6">
<Posts /> <Suspense fallback={<div>Loading...</div>}>
<Posts />
</Suspense>
</div> </div>
); );
} }

View File

@ -4,7 +4,7 @@ import { use } from 'react';
import ReactMarkdown from 'react-markdown'; import ReactMarkdown from 'react-markdown';
import remarkGfm from 'remark-gfm'; import remarkGfm from 'remark-gfm';
const Posts = () => { export default function Posts() {
const c = cookies(); const c = cookies();
const posts = use(getPosts()); const posts = use(getPosts());
@ -27,6 +27,4 @@ const Posts = () => {
))} ))}
</> </>
); );
}; }
export default Posts;

View File

@ -2,7 +2,6 @@
const nextConfig = { const nextConfig = {
reactStrictMode: true, // Recommended for the `pages` directory, default in `app`. reactStrictMode: true, // Recommended for the `pages` directory, default in `app`.
swcMinify: true, swcMinify: true,
output: 'standalone',
experimental: { experimental: {
// Required: // Required:
appDir: true, appDir: true,

View File

@ -18,7 +18,7 @@
"dependencies": { "dependencies": {
"clsx": "1.2.1", "clsx": "1.2.1",
"concurrently": "7.5.0", "concurrently": "7.5.0",
"next": "latest", "next": "13.0.2",
"react": "18.2.0", "react": "18.2.0",
"react-dom": "18.2.0", "react-dom": "18.2.0",
"react-markdown": "8.0.3", "react-markdown": "8.0.3",

View File

@ -3113,7 +3113,7 @@ natural-compare@^1.4.0:
resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7"
integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw== integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==
next@latest: next@13.0.2:
version "13.0.2" version "13.0.2"
resolved "https://registry.yarnpkg.com/next/-/next-13.0.2.tgz#b8c8642c70f736ed91105645391d335fc51c8f62" resolved "https://registry.yarnpkg.com/next/-/next-13.0.2.tgz#b8c8642c70f736ed91105645391d335fc51c8f62"
integrity sha512-uQ5z5e4D9mOe8+upy6bQdYYjo/kk1v3jMW87kTy2TgAyAsEO+CkwRnMgyZ4JoHEnhPZLHwh7dk0XymRNLe1gFw== integrity sha512-uQ5z5e4D9mOe8+upy6bQdYYjo/kk1v3jMW87kTy2TgAyAsEO+CkwRnMgyZ4JoHEnhPZLHwh7dk0XymRNLe1gFw==