fix: make about.md optional and copy content folder in Dockerfile
This commit is contained in:
@@ -33,6 +33,7 @@ RUN addgroup --system --gid 1001 nodejs
|
|||||||
RUN adduser --system --uid 1001 nextjs
|
RUN adduser --system --uid 1001 nextjs
|
||||||
|
|
||||||
COPY --from=builder /app/public ./public
|
COPY --from=builder /app/public ./public
|
||||||
|
COPY --from=builder /app/content ./content
|
||||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
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/.next/static ./.next/static
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,11 @@ interface AboutFrontmatter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getAboutContent() {
|
function getAboutContent() {
|
||||||
const raw = readFileSync(join(process.cwd(), 'content', 'about.md'), 'utf-8');
|
const filePath = join(process.cwd(), 'content', 'about.md');
|
||||||
|
if (!require('fs').existsSync(filePath)) {
|
||||||
|
return { meta: {} as AboutFrontmatter, body: '' };
|
||||||
|
}
|
||||||
|
const raw = readFileSync(filePath, 'utf-8');
|
||||||
const { data, content } = matter(raw);
|
const { data, content } = matter(raw);
|
||||||
return { meta: data as AboutFrontmatter, body: content.trim() };
|
return { meta: data as AboutFrontmatter, body: content.trim() };
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user