Docusaurus通过容器部署


发布于 2023-09-18 / 358 阅读 / 1 评论 /
Docusaurus通过容器部署

Docusaurus相关站点

官方网站

GitHub项目地址

演示站点

rhel8安装docker

#推荐一个优秀的系统源优化的网站
https://linuxmirrors.cn/mirrors
​
#配置系统源
bash <(curl -sSL https://linuxmirrors.cn/main.sh)
​
#安装docker
bash <(curl -sSL https://linuxmirrors.cn/docker.sh)
​
#安装docker-compose
curl -sSL -o /usr/local/bin/docker-compose https://drive.swireb.cn/d/Linux/Docker/docker-compose
chmod +x /usr/local/bin/docker-compose
docker-compose -v

使用docker部署

docker run -d --name=docusaurus \
	-p 8000:80 \
	-v ./docusaurus:/docusaurus \
	-e TARGET_UID=1000 \
	-e TARGET_GID=1000 \
        -e VERSION="latest" \
	-e WEBSITE_NAME="my-website" \
	-e TEMPLATE=classic \
	jackywn/docusaurus

使用docker-compose部署

git clone https://github.com/Jack-Ywn/docusaurus-docker.git
​
cd docusaurus-docker
​
docker-compose up -d

构建容器镜像

git clone https://github.com/Jack-Ywn/docusaurus-docker.git
​
cd docusaurus-docker/build
​
docker build -t jackywn/docusaurus .

Nginx反向代理Docusaurus容器

server {
    listen 80;
    listen 443 ssl http2;
​
    server_name                test.com;
    server_name_in_redirect    on;
    port_in_redirect           on;
​
    if ( $scheme = http ) { return 301 https://$host$request_uri; }
​
    ssl_certificate          /etc/nginx/cert/test.com.pem;
    ssl_certificate_key      /etc/nginx/cert/test.com.key;
​
​
    location / {
        proxy_pass  http://127.0.0.1:8000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-Port $server_port;
    }
}




是否对你有帮助?

评论