mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-03 16:59:06 +02:00
parent
96255cdf18
commit
5301d819a4
24 changed files with 414 additions and 358 deletions
|
@ -1,4 +1,4 @@
|
|||
<!DOCTYPE html><html lang="zh-CN"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Docker · Docusaurus</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="[Docker](https://www.docker.com/) is a tool that enables you to create, deploy, and manage lightweight, stand-alone packages that contain everything needed to run an application. It can help us to avoid conflicting dependencies & unwanted behavior when running Docusaurus."/><meta name="docsearch:version" content="next"/><meta name="docsearch:language" content="zh-CN"/><meta property="og:title" content="Docker · Docusaurus"/><meta property="og:type" content="website"/><meta property="og:url" content="https://docusaurus.io/"/><meta property="og:description" content="[Docker](https://www.docker.com/) is a tool that enables you to create, deploy, and manage lightweight, stand-alone packages that contain everything needed to run an application. It can help us to avoid conflicting dependencies & unwanted behavior when running Docusaurus."/><meta property="og:image" content="https://docusaurus.io/img/docusaurus.png"/><meta name="twitter:card" content="summary"/><meta name="twitter:image" content="https://docusaurus.io/img/docusaurus.png"/><link rel="shortcut icon" href="/img/docusaurus.ico"/><link rel="stylesheet" href="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.css"/><link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/atom-one-dark.min.css"/><link rel="alternate" type="application/atom+xml" href="https://docusaurus.io/blog/atom.xml" title="Docusaurus Blog ATOM Feed"/><link rel="alternate" type="application/rss+xml" href="https://docusaurus.io/blog/feed.xml" title="Docusaurus Blog RSS Feed"/><script>
|
||||
<!DOCTYPE html><html lang="zh-CN"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Docker · Docusaurus</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="[Docker](https://www.docker.com/) 是一个可以让你创建、部署和管理轻量化、独立包的工具,他包含了应用运行所有的依赖。 当运行Docusaurus的时候,它可以帮助我们避免依赖冲突和一些异常行为。"/><meta name="docsearch:version" content="next"/><meta name="docsearch:language" content="zh-CN"/><meta property="og:title" content="Docker · Docusaurus"/><meta property="og:type" content="website"/><meta property="og:url" content="https://docusaurus.io/"/><meta property="og:description" content="[Docker](https://www.docker.com/) 是一个可以让你创建、部署和管理轻量化、独立包的工具,他包含了应用运行所有的依赖。 当运行Docusaurus的时候,它可以帮助我们避免依赖冲突和一些异常行为。"/><meta property="og:image" content="https://docusaurus.io/img/docusaurus.png"/><meta name="twitter:card" content="summary"/><meta name="twitter:image" content="https://docusaurus.io/img/docusaurus.png"/><link rel="shortcut icon" href="/img/docusaurus.ico"/><link rel="stylesheet" href="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.css"/><link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/atom-one-dark.min.css"/><link rel="alternate" type="application/atom+xml" href="https://docusaurus.io/blog/atom.xml" title="Docusaurus Blog ATOM Feed"/><link rel="alternate" type="application/rss+xml" href="https://docusaurus.io/blog/feed.xml" title="Docusaurus Blog RSS Feed"/><script>
|
||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||
|
@ -80,18 +80,18 @@
|
|||
};
|
||||
}
|
||||
});
|
||||
</script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/docusaurus/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">Docker</h1></header><article><div><span><p><a href="https://www.docker.com/">Docker</a> is a tool that enables you to create, deploy, and manage lightweight, stand-alone packages that contain everything needed to run an application. It can help us to avoid conflicting dependencies & unwanted behavior when running Docusaurus.</p>
|
||||
<h2><a class="anchor" aria-hidden="true" id="用-docker-运行本地网络服务器"></a><a href="#用-docker-运行本地网络服务器" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>用 Docker 运行本地网络服务器</h2>
|
||||
<p>Ensure you have previously installed <a href="https://www.docker.com/get-started">docker</a>.</p>
|
||||
<p>To run the local web server:</p>
|
||||
</script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/docusaurus/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">Docker</h1></header><article><div><span><p><a href="https://www.docker.com/">Docker</a> 是一个可以让你创建、部署和管理轻量化、独立包的工具,他包含了应用运行所有的依赖。 当运行Docusaurus的时候,它可以帮助我们避免依赖冲突和一些异常行为。</p>
|
||||
<h2><a class="anchor" aria-hidden="true" id="用-docker-本地运行服务"></a><a href="#用-docker-本地运行服务" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>用 Docker 本地运行服务</h2>
|
||||
<p>在这之前确保你已经安装了<a href="https://www.docker.com/get-started">Docker</a>。</p>
|
||||
<p>准备运行本地服务:</p>
|
||||
<ol>
|
||||
<li><p><strong>Build the docker image</strong> -- Enter the folder where you have Docusaurus installed. Run <code>docker build -t docusaurus-doc .</code></p>
|
||||
<p>Once the build phase finishes, you can verify the image exists by running <code>docker images</code>.</p>
|
||||
<li><p><strong>构建Docker镜像</strong> -- 进到你安装Docusaurus的目录。 运行<code>docker build -t docusaurus-doc .</code></p>
|
||||
<p>当构建镜像的阶段结束的时候,你可以通过<code>docker images</code>来验证时候构建成功。</p>
|
||||
<blockquote>
|
||||
<p>We now include a <code>Dockerfile</code> when you install Docusaurus.</p>
|
||||
<p>当你安装Docusaurus的时候我们已经有一个<code>Dockerfile</code>了。</p>
|
||||
</blockquote></li>
|
||||
<li><p><strong>Run the Docusaurus container</strong> -- To start docker run <code>docker run --rm -p 3000:3000 docusaurus-doc</code></p>
|
||||
<p>This will start a docker container with the image <code>docusaurus-doc</code>. To see more detailed container info run <code>docker ps</code> .</p></li>
|
||||
<li><p><strong>运行Docusaurus容器</strong>--运行Docker<code>docker run --rm -p 3000:3000 docusaurus-doc</code></p>
|
||||
<p>这将运行一个镜像为<code>docusaurus-doc</code>的Docker容器。 想看更详细的容器信息运行<code>docker ps</code></p></li>
|
||||
</ol>
|
||||
<h2><a class="anchor" aria-hidden="true" id="使用-docker-compose"></a><a href="#使用-docker-compose" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>使用 docker-compose</h2>
|
||||
<p>We can also use <code>docker-compose</code> to configure our application. This feature of docker allows you to run the web server and any additional services with a single command.</p>
|
||||
|
@ -128,7 +128,7 @@
|
|||
</code></pre>
|
||||
<p>To run a local web server with <code>docker-compose</code> run <code>docker-compose up</code>.</p>
|
||||
<p>To build static HTML pages for publishing run <code>docker-compose run docusaurus bash -c 'yarn publish-gh-pages'</code></p>
|
||||
</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/next/publishing"><span class="arrow-prev">← </span><span>发布你的站点</span></a><a class="docs-next button" href="/docs/zh-CN/next/adding-blog"><span>添加博客</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#用-docker-运行本地网络服务器">用 Docker 运行本地网络服务器</a></li><li><a href="#使用-docker-compose">使用 docker-compose</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/docusaurus_monochrome.svg" alt="Docusaurus" width="66" height="58"/></a><div class="footerSection"><h5>Docs</h5><a href="
|
||||
</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/next/publishing"><span class="arrow-prev">← </span><span>发布你的站点</span></a><a class="docs-next button" href="/docs/zh-CN/next/adding-blog"><span>添加博客</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#用-docker-本地运行服务">用 Docker 本地运行服务</a></li><li><a href="#使用-docker-compose">使用 docker-compose</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/docusaurus_monochrome.svg" alt="Docusaurus" width="66" height="58"/></a><div class="footerSection"><h5>Docs</h5><a href="
|
||||
/docs/zh-CN/installation">Getting Started</a><a href="
|
||||
/docs/zh-CN/versioning">Versioning</a><a href="
|
||||
/docs/zh-CN/translation">Localization</a><a href="
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!DOCTYPE html><html lang="zh-CN"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Docker · Docusaurus</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="[Docker](https://www.docker.com/) is a tool that enables you to create, deploy, and manage lightweight, stand-alone packages that contain everything needed to run an application. It can help us to avoid conflicting dependencies & unwanted behavior when running Docusaurus."/><meta name="docsearch:version" content="next"/><meta name="docsearch:language" content="zh-CN"/><meta property="og:title" content="Docker · Docusaurus"/><meta property="og:type" content="website"/><meta property="og:url" content="https://docusaurus.io/"/><meta property="og:description" content="[Docker](https://www.docker.com/) is a tool that enables you to create, deploy, and manage lightweight, stand-alone packages that contain everything needed to run an application. It can help us to avoid conflicting dependencies & unwanted behavior when running Docusaurus."/><meta property="og:image" content="https://docusaurus.io/img/docusaurus.png"/><meta name="twitter:card" content="summary"/><meta name="twitter:image" content="https://docusaurus.io/img/docusaurus.png"/><link rel="shortcut icon" href="/img/docusaurus.ico"/><link rel="stylesheet" href="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.css"/><link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/atom-one-dark.min.css"/><link rel="alternate" type="application/atom+xml" href="https://docusaurus.io/blog/atom.xml" title="Docusaurus Blog ATOM Feed"/><link rel="alternate" type="application/rss+xml" href="https://docusaurus.io/blog/feed.xml" title="Docusaurus Blog RSS Feed"/><script>
|
||||
<!DOCTYPE html><html lang="zh-CN"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Docker · Docusaurus</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="[Docker](https://www.docker.com/) 是一个可以让你创建、部署和管理轻量化、独立包的工具,他包含了应用运行所有的依赖。 当运行Docusaurus的时候,它可以帮助我们避免依赖冲突和一些异常行为。"/><meta name="docsearch:version" content="next"/><meta name="docsearch:language" content="zh-CN"/><meta property="og:title" content="Docker · Docusaurus"/><meta property="og:type" content="website"/><meta property="og:url" content="https://docusaurus.io/"/><meta property="og:description" content="[Docker](https://www.docker.com/) 是一个可以让你创建、部署和管理轻量化、独立包的工具,他包含了应用运行所有的依赖。 当运行Docusaurus的时候,它可以帮助我们避免依赖冲突和一些异常行为。"/><meta property="og:image" content="https://docusaurus.io/img/docusaurus.png"/><meta name="twitter:card" content="summary"/><meta name="twitter:image" content="https://docusaurus.io/img/docusaurus.png"/><link rel="shortcut icon" href="/img/docusaurus.ico"/><link rel="stylesheet" href="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.css"/><link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/atom-one-dark.min.css"/><link rel="alternate" type="application/atom+xml" href="https://docusaurus.io/blog/atom.xml" title="Docusaurus Blog ATOM Feed"/><link rel="alternate" type="application/rss+xml" href="https://docusaurus.io/blog/feed.xml" title="Docusaurus Blog RSS Feed"/><script>
|
||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||
|
@ -80,18 +80,18 @@
|
|||
};
|
||||
}
|
||||
});
|
||||
</script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/docusaurus/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">Docker</h1></header><article><div><span><p><a href="https://www.docker.com/">Docker</a> is a tool that enables you to create, deploy, and manage lightweight, stand-alone packages that contain everything needed to run an application. It can help us to avoid conflicting dependencies & unwanted behavior when running Docusaurus.</p>
|
||||
<h2><a class="anchor" aria-hidden="true" id="用-docker-运行本地网络服务器"></a><a href="#用-docker-运行本地网络服务器" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>用 Docker 运行本地网络服务器</h2>
|
||||
<p>Ensure you have previously installed <a href="https://www.docker.com/get-started">docker</a>.</p>
|
||||
<p>To run the local web server:</p>
|
||||
</script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/docusaurus/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">Docker</h1></header><article><div><span><p><a href="https://www.docker.com/">Docker</a> 是一个可以让你创建、部署和管理轻量化、独立包的工具,他包含了应用运行所有的依赖。 当运行Docusaurus的时候,它可以帮助我们避免依赖冲突和一些异常行为。</p>
|
||||
<h2><a class="anchor" aria-hidden="true" id="用-docker-本地运行服务"></a><a href="#用-docker-本地运行服务" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>用 Docker 本地运行服务</h2>
|
||||
<p>在这之前确保你已经安装了<a href="https://www.docker.com/get-started">Docker</a>。</p>
|
||||
<p>准备运行本地服务:</p>
|
||||
<ol>
|
||||
<li><p><strong>Build the docker image</strong> -- Enter the folder where you have Docusaurus installed. Run <code>docker build -t docusaurus-doc .</code></p>
|
||||
<p>Once the build phase finishes, you can verify the image exists by running <code>docker images</code>.</p>
|
||||
<li><p><strong>构建Docker镜像</strong> -- 进到你安装Docusaurus的目录。 运行<code>docker build -t docusaurus-doc .</code></p>
|
||||
<p>当构建镜像的阶段结束的时候,你可以通过<code>docker images</code>来验证时候构建成功。</p>
|
||||
<blockquote>
|
||||
<p>We now include a <code>Dockerfile</code> when you install Docusaurus.</p>
|
||||
<p>当你安装Docusaurus的时候我们已经有一个<code>Dockerfile</code>了。</p>
|
||||
</blockquote></li>
|
||||
<li><p><strong>Run the Docusaurus container</strong> -- To start docker run <code>docker run --rm -p 3000:3000 docusaurus-doc</code></p>
|
||||
<p>This will start a docker container with the image <code>docusaurus-doc</code>. To see more detailed container info run <code>docker ps</code> .</p></li>
|
||||
<li><p><strong>运行Docusaurus容器</strong>--运行Docker<code>docker run --rm -p 3000:3000 docusaurus-doc</code></p>
|
||||
<p>这将运行一个镜像为<code>docusaurus-doc</code>的Docker容器。 想看更详细的容器信息运行<code>docker ps</code></p></li>
|
||||
</ol>
|
||||
<h2><a class="anchor" aria-hidden="true" id="使用-docker-compose"></a><a href="#使用-docker-compose" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>使用 docker-compose</h2>
|
||||
<p>We can also use <code>docker-compose</code> to configure our application. This feature of docker allows you to run the web server and any additional services with a single command.</p>
|
||||
|
@ -128,7 +128,7 @@
|
|||
</code></pre>
|
||||
<p>To run a local web server with <code>docker-compose</code> run <code>docker-compose up</code>.</p>
|
||||
<p>To build static HTML pages for publishing run <code>docker-compose run docusaurus bash -c 'yarn publish-gh-pages'</code></p>
|
||||
</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/next/publishing"><span class="arrow-prev">← </span><span>发布你的站点</span></a><a class="docs-next button" href="/docs/zh-CN/next/adding-blog"><span>添加博客</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#用-docker-运行本地网络服务器">用 Docker 运行本地网络服务器</a></li><li><a href="#使用-docker-compose">使用 docker-compose</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/docusaurus_monochrome.svg" alt="Docusaurus" width="66" height="58"/></a><div class="footerSection"><h5>Docs</h5><a href="
|
||||
</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/next/publishing"><span class="arrow-prev">← </span><span>发布你的站点</span></a><a class="docs-next button" href="/docs/zh-CN/next/adding-blog"><span>添加博客</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#用-docker-本地运行服务">用 Docker 本地运行服务</a></li><li><a href="#使用-docker-compose">使用 docker-compose</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/docusaurus_monochrome.svg" alt="Docusaurus" width="66" height="58"/></a><div class="footerSection"><h5>Docs</h5><a href="
|
||||
/docs/zh-CN/installation">Getting Started</a><a href="
|
||||
/docs/zh-CN/versioning">Versioning</a><a href="
|
||||
/docs/zh-CN/translation">Localization</a><a href="
|
||||
|
|
|
@ -81,27 +81,31 @@
|
|||
}
|
||||
});
|
||||
</script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/docusaurus/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">Publish the Site</h1></header><article><div><span><p><img alt="Docusaurus Facebook" src="/img/undraw_docusaurus_fb.svg" class="docImage" /></p>
|
||||
<p>Next, we'll learn how to publish the site to the WWW for everyone to browse! For the purpose of the tutorial, we'll use GitHub pages to host our website. But you can use any static file hosting service that you want, e.g. Netlify, Amazon S3, etc.</p>
|
||||
<p>Next, we'll learn how to publish the site to the WWW for everyone to browse! For the purpose of the tutorial, we'll use GitHub Pages to host our website. But you can use any static file hosting service that you want, like Netlify, Amazon S3, etc.</p>
|
||||
<h2><a class="anchor" aria-hidden="true" id="put-the-site-online"></a><a href="#put-the-site-online" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Put the Site Online</h2>
|
||||
<p>Kill the web server first by pressing Cmd + C or Ctrl + C depending on your operating system.</p>
|
||||
<p>In <code>website/siteConfig.js</code>, fill in the following fields:</p>
|
||||
<pre><code class="hljs">const siteConfig = {
|
||||
...
|
||||
url: 'https://USERNAME.github.io', // Replace USERNAME with your GitHub username.
|
||||
baseUrl: '/docusaurus-tutorial/', // The name of your GitHub project.
|
||||
projectName: 'docusaurus-tutorial', // The name of your GitHub project. Same as above.
|
||||
organizationName: 'USERNAME' // Your GitHub username.
|
||||
...
|
||||
}
|
||||
</code></pre>
|
||||
<ol start="2">
|
||||
<li><p>In the <code>website</code> directory, run <code>npm run build</code> or <code>yarn build</code>. 这将在 <code>website</code> 目录下生成一个 <code>build</code> 文件夹, 其中包含 <code>website</code> 目录下所有文档和其他页面中所含的 <code>.html</code> 文件。 Make sure the <code>build</code> directory is there before running the next step.</p></li>
|
||||
<li><p>Replace <code><GIT_USER></code> with your GitHub username and run the following command.</p>
|
||||
<p>$ GIT_USER=<GIT_USER> CURRENT_BRANCH=master USE_SSH=true npm run publish-gh-pages</p></li>
|
||||
<ol>
|
||||
<li><p>Edit the file <code>docusaurus-tutorial/website/siteConfig.js</code> and fill in the following values:</p>
|
||||
<p>const siteConfig = {
|
||||
...
|
||||
url: '<a href="https://USERNAME.github.io">https://USERNAME.github.io</a>', // Replace USERNAME with your GitHub username.
|
||||
baseUrl: '/docusaurus-tutorial/', // The name of your GitHub project.
|
||||
projectName: 'docusaurus-tutorial', // The name of your GitHub project. Same as above.
|
||||
organizationName: 'USERNAME' // Your GitHub username.
|
||||
...
|
||||
}</p></li>
|
||||
</ol>
|
||||
<p>The built code will be pushed to the <code>gh-pages</code> branch of your repository.</p>
|
||||
<ol start="4">
|
||||
<li>Go to <code>https://USERNAME.github.io/docusaurus-tutorial/</code> and view your site in action!</li>
|
||||
<ol start="2">
|
||||
<li>In Terminal or Git Bash, kill the web server by pressing <strong>Cmd+C</strong> or <strong>Ctrl+C</strong>.</li>
|
||||
<li>In the <code>website</code> directory, run <code>npm run build</code> or <code>yarn build</code>. The command generates a <code>build</code> directory inside the <code>website</code> directory, containing HTML files (and other file types) for all of your docs and other pages. Make sure the <code>docusaurus-tutorial/website/build</code> directory is successfully created before running the next step.</li>
|
||||
<li>Replace <code>USERNAME</code> with your GitHub username and run the following command.</li>
|
||||
</ol>
|
||||
<pre><code class="hljs css language-sh">GIT_USER=USERNAME CURRENT_BRANCH=master USE_SSH=<span class="hljs-literal">true</span> npm run publish-gh-pages <span class="hljs-comment"># SSH</span>
|
||||
<span class="hljs-comment"># or</span>
|
||||
GIT_USER=USERNAME CURRENT_BRANCH=master npm run publish-gh-pages <span class="hljs-comment"># HTTPS</span>
|
||||
</code></pre>
|
||||
<p>The HTML files (and other file types) are pushed to the <code>gh-pages</code> branch of your repository: <a href="https://github.com/USERNAME/docusaurus-tutorial">https://github.com/USERNAME/docusaurus-tutorial</a>.</p>
|
||||
<ol start="5">
|
||||
<li>Go to <a href="https://USERNAME.github.io/docusaurus-tutorial/">https://USERNAME.github.io/docusaurus-tutorial/</a> and view your site in action!</li>
|
||||
</ol>
|
||||
<blockquote>
|
||||
<p>Note that when you run <code>npm run start</code> again, the <code>baseUrl</code> will now be part of the path.</p>
|
||||
|
|
|
@ -81,27 +81,31 @@
|
|||
}
|
||||
});
|
||||
</script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/docusaurus/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">Publish the Site</h1></header><article><div><span><p><img alt="Docusaurus Facebook" src="/img/undraw_docusaurus_fb.svg" class="docImage" /></p>
|
||||
<p>Next, we'll learn how to publish the site to the WWW for everyone to browse! For the purpose of the tutorial, we'll use GitHub pages to host our website. But you can use any static file hosting service that you want, e.g. Netlify, Amazon S3, etc.</p>
|
||||
<p>Next, we'll learn how to publish the site to the WWW for everyone to browse! For the purpose of the tutorial, we'll use GitHub Pages to host our website. But you can use any static file hosting service that you want, like Netlify, Amazon S3, etc.</p>
|
||||
<h2><a class="anchor" aria-hidden="true" id="put-the-site-online"></a><a href="#put-the-site-online" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Put the Site Online</h2>
|
||||
<p>Kill the web server first by pressing Cmd + C or Ctrl + C depending on your operating system.</p>
|
||||
<p>In <code>website/siteConfig.js</code>, fill in the following fields:</p>
|
||||
<pre><code class="hljs">const siteConfig = {
|
||||
...
|
||||
url: 'https://USERNAME.github.io', // Replace USERNAME with your GitHub username.
|
||||
baseUrl: '/docusaurus-tutorial/', // The name of your GitHub project.
|
||||
projectName: 'docusaurus-tutorial', // The name of your GitHub project. Same as above.
|
||||
organizationName: 'USERNAME' // Your GitHub username.
|
||||
...
|
||||
}
|
||||
</code></pre>
|
||||
<ol start="2">
|
||||
<li><p>In the <code>website</code> directory, run <code>npm run build</code> or <code>yarn build</code>. 这将在 <code>website</code> 目录下生成一个 <code>build</code> 文件夹, 其中包含 <code>website</code> 目录下所有文档和其他页面中所含的 <code>.html</code> 文件。 Make sure the <code>build</code> directory is there before running the next step.</p></li>
|
||||
<li><p>Replace <code><GIT_USER></code> with your GitHub username and run the following command.</p>
|
||||
<p>$ GIT_USER=<GIT_USER> CURRENT_BRANCH=master USE_SSH=true npm run publish-gh-pages</p></li>
|
||||
<ol>
|
||||
<li><p>Edit the file <code>docusaurus-tutorial/website/siteConfig.js</code> and fill in the following values:</p>
|
||||
<p>const siteConfig = {
|
||||
...
|
||||
url: '<a href="https://USERNAME.github.io">https://USERNAME.github.io</a>', // Replace USERNAME with your GitHub username.
|
||||
baseUrl: '/docusaurus-tutorial/', // The name of your GitHub project.
|
||||
projectName: 'docusaurus-tutorial', // The name of your GitHub project. Same as above.
|
||||
organizationName: 'USERNAME' // Your GitHub username.
|
||||
...
|
||||
}</p></li>
|
||||
</ol>
|
||||
<p>The built code will be pushed to the <code>gh-pages</code> branch of your repository.</p>
|
||||
<ol start="4">
|
||||
<li>Go to <code>https://USERNAME.github.io/docusaurus-tutorial/</code> and view your site in action!</li>
|
||||
<ol start="2">
|
||||
<li>In Terminal or Git Bash, kill the web server by pressing <strong>Cmd+C</strong> or <strong>Ctrl+C</strong>.</li>
|
||||
<li>In the <code>website</code> directory, run <code>npm run build</code> or <code>yarn build</code>. The command generates a <code>build</code> directory inside the <code>website</code> directory, containing HTML files (and other file types) for all of your docs and other pages. Make sure the <code>docusaurus-tutorial/website/build</code> directory is successfully created before running the next step.</li>
|
||||
<li>Replace <code>USERNAME</code> with your GitHub username and run the following command.</li>
|
||||
</ol>
|
||||
<pre><code class="hljs css language-sh">GIT_USER=USERNAME CURRENT_BRANCH=master USE_SSH=<span class="hljs-literal">true</span> npm run publish-gh-pages <span class="hljs-comment"># SSH</span>
|
||||
<span class="hljs-comment"># or</span>
|
||||
GIT_USER=USERNAME CURRENT_BRANCH=master npm run publish-gh-pages <span class="hljs-comment"># HTTPS</span>
|
||||
</code></pre>
|
||||
<p>The HTML files (and other file types) are pushed to the <code>gh-pages</code> branch of your repository: <a href="https://github.com/USERNAME/docusaurus-tutorial">https://github.com/USERNAME/docusaurus-tutorial</a>.</p>
|
||||
<ol start="5">
|
||||
<li>Go to <a href="https://USERNAME.github.io/docusaurus-tutorial/">https://USERNAME.github.io/docusaurus-tutorial/</a> and view your site in action!</li>
|
||||
</ol>
|
||||
<blockquote>
|
||||
<p>Note that when you run <code>npm run start</code> again, the <code>baseUrl</code> will now be part of the path.</p>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue