Dockerfile.docs•4.58 kB
# Documentation testing container
# Generated by DocuMCP
FROM node:20-alpine
WORKDIR /app
# Copy documentation source first
COPY docs ./docs/
# Create docs-site directory structure
RUN mkdir -p docs-site/src/css
# Create all configuration files using a single RUN command with shell script
RUN sh -c 'set -e && \
# Generate package.json \
echo "{ \
\"name\": \"documcp-docs\", \
\"version\": \"0.0.0\", \
\"private\": true, \
\"scripts\": { \
\"docusaurus\": \"docusaurus\", \
\"start\": \"docusaurus start\", \
\"build\": \"docusaurus build\", \
\"swizzle\": \"docusaurus swizzle\", \
\"deploy\": \"docusaurus deploy\", \
\"clear\": \"docusaurus clear\", \
\"serve\": \"docusaurus serve --port 3001\" \
}, \
\"dependencies\": { \
\"@docusaurus/core\": \"^3.0.0\", \
\"@docusaurus/preset-classic\": \"^3.0.0\", \
\"@mdx-js/react\": \"^3.0.0\", \
\"clsx\": \"^2.0.0\", \
\"prism-react-renderer\": \"^2.1.0\", \
\"react\": \"^18.0.0\", \
\"react-dom\": \"^18.0.0\" \
}, \
\"devDependencies\": { \
\"@docusaurus/types\": \"^3.0.0\" \
} \
}" > docs-site/package.json && \
# Generate docusaurus.config.js \
cat > docs-site/docusaurus.config.js << "DOCUSAURUS_EOF"
module.exports = {
title: "DocuMCP",
tagline: "Intelligent Model Context Protocol server for documentation deployment",
url: "https://tosin2013.github.io",
baseUrl: "/documcp/",
onBrokenLinks: "warn",
onBrokenMarkdownLinks: "warn",
favicon: "img/favicon.ico",
organizationName: "tosin2013",
projectName: "documcp",
presets: [
[
"classic",
{
docs: {
sidebarPath: require.resolve("./sidebars.js"),
editUrl: "https://github.com/tosin2013/documcp/tree/main/docs/",
path: "../docs",
routeBasePath: "/",
},
theme: {
customCss: require.resolve("./src/css/custom.css"),
},
blog: false,
},
],
],
themeConfig: {
navbar: {
title: "DocuMCP",
items: [
{
type: "doc",
docId: "index",
position: "left",
label: "Documentation",
},
{
href: "https://github.com/tosin2013/documcp",
label: "GitHub",
position: "right",
},
],
},
},
exclude: [
"**/node_modules/**",
"**/.docusaurus/**",
"**/build/**",
"**/package.json",
"**/package-lock.json",
],
};
DOCUSAURUS_EOF
# Generate sidebars.js \
cat > docs-site/sidebars.js << "SIDEBARS_EOF"
/** @type {import("@docusaurus/plugin-content-docs").SidebarsConfig} */
const sidebars = {
docs: [
"index",
{
type: "category",
label: "Tutorials",
items: [
{
type: "autogenerated",
dirName: "tutorials",
},
],
},
{
type: "category",
label: "How-to Guides",
items: [
{
type: "autogenerated",
dirName: "how-to",
},
],
},
{
type: "category",
label: "Reference",
items: [
{
type: "autogenerated",
dirName: "reference",
},
],
},
{
type: "category",
label: "Explanation",
items: [
{
type: "autogenerated",
dirName: "explanation",
},
],
},
],
};
module.exports = sidebars;
SIDEBARS_EOF
# Generate custom.css \
cat > docs-site/src/css/custom.css << "CSS_EOF"
:root {
--ifm-color-primary: #2e8555;
--ifm-color-primary-dark: #29784c;
--ifm-color-primary-darker: #277148;
--ifm-color-primary-darkest: #205d3b;
--ifm-color-primary-light: #33925d;
--ifm-color-primary-lighter: #359962;
--ifm-color-primary-lightest: #3cad6e;
--ifm-code-font-size: 95%;
--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.1);
}
[data-theme="dark"] {
--ifm-color-primary: #25c2a0;
--ifm-color-primary-dark: #21af90;
--ifm-color-primary-darker: #1fa588;
--ifm-color-primary-darkest: #1a8870;
--ifm-color-primary-light: #29d5b0;
--ifm-color-primary-lighter: #32d8b4;
--ifm-color-primary-lightest: #4fddbf;
--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.3);
}
CSS_EOF
'
# Install dependencies
RUN cd docs-site && npm install
# Build documentation
RUN cd docs-site && npm run build
# Expose port
EXPOSE 3001
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:3001/ || exit 1
# Start server
CMD ["sh", "-c", "cd docs-site && npm run serve"]