From 85e31ae1066abeda8a73177ed2f07f58676b6c92 Mon Sep 17 00:00:00 2001 From: gsw945 Date: Fri, 15 Oct 2021 12:16:06 +0800 Subject: [PATCH] =?UTF-8?q?ubuntu=E6=BA=90=E4=BF=AE=E5=A4=8D=E3=80=81calib?= =?UTF-8?q?re-github-release=E4=B8=8B=E8=BD=BD=E5=8A=A0=E9=80=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 42 +++++++++++++++++++++--------------------- README.md | 4 ++++ 2 files changed, 25 insertions(+), 21 deletions(-) diff --git a/Dockerfile b/Dockerfile index 98e85179e..2a4846d1b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -41,26 +41,25 @@ COPY --from=build /go/src/github.com/mindoc-org/mindoc /mindoc WORKDIR /mindoc RUN chmod a+r /usr/share/fonts/win/simsun.ttc -# # 备份原有源 -# RUN mv /etc/apt/sources.list /etc/apt/sources.list-backup -# # 最小化源,缩短apt update时间(ca-certificates必须先安装才支持换tsinghua源) -# RUN echo 'deb http://archive.ubuntu.com/ubuntu/ focal main restricted' > /etc/apt/sources.list -# RUN apt-get update -# RUN apt install -y ca-certificates -# # 更换tsinghua源(echo多行内容不能以#开头,会被docker误判为注释行,所以采用\n#开头) -# RUN echo $'\ -# \n# from: https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/\n\ -# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse\ -# \n# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse\n\ -# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse\ -# \n# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse\n\ -# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse\ -# \n# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse\n\ -# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse\ -# \n# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse\ -# \n# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse\ -# \n# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse'\ -# > /etc/apt/sources.list +# 备份原有源 +RUN mv /etc/apt/sources.list /etc/apt/sources.list-backup +# 最小化源,缩短apt update时间(ca-certificates必须先安装才支持换tsinghua源) +RUN echo 'deb http://archive.ubuntu.com/ubuntu/ focal main restricted' > /etc/apt/sources.list +RUN apt-get update +RUN apt install -y ca-certificates +# 更换aliyun源(echo多行内容不能以#开头,会被docker误判为注释行,所以采用\n#开头) +RUN echo $'\ +deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse\ +\n# deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse\n\ +deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse\ +\n# deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse\n\ +deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse\ +\n# deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse\n\ +deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse\ +\n# deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse\n\ +deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse\ +\n# deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse'\ +> /etc/apt/sources.list # 更新软件包信息 RUN apt-get update @@ -96,7 +95,8 @@ RUN mkdir -p /tmp/calibre-cache RUN curl -s http://code.calibre-ebook.com/latest>/tmp/calibre-cache/version # 下载最新版本 # RUN wget -O /tmp/calibre-cache/calibre-x86_64.txz -c https://download.calibre-ebook.com/`cat /tmp/calibre-cache/version`/calibre-`cat /tmp/calibre-cache/version`-x86_64.txz -RUN wget -O /tmp/calibre-cache/calibre-x86_64.txz -c https://github.com/kovidgoyal/calibre/releases/download/v`cat /tmp/calibre-cache/version`/calibre-`cat /tmp/calibre-cache/version`-x86_64.txz +# 使用 download.fastgit.org 替换 github 实现加速 +RUN wget -O /tmp/calibre-cache/calibre-x86_64.txz -c https://download.fastgit.org/kovidgoyal/calibre/releases/download/v`cat /tmp/calibre-cache/version`/calibre-`cat /tmp/calibre-cache/version`-x86_64.txz # 注: 调试阶段,下载alibre-5.22.1-x86_64.txz到本地(使用 python -m http.server),加速构建 # RUN wget -O /tmp/calibre-cache/calibre-x86_64.txz -c http://10.96.8.252:8000/calibre-5.22.1-x86_64.txz # 解压 diff --git a/README.md b/README.md index 0fd2a0c48..ac738cbb1 100644 --- a/README.md +++ b/README.md @@ -145,6 +145,10 @@ docker run -it --name=mindoc --restart=always -v "${MINDOC}":"/mindoc-sync-host" docker run -p 8181:8181 --name mindoc -e DB_ADAPTER=mysql -e MYSQL_PORT_3306_TCP_ADDR=10.xxx.xxx.xxx -e MYSQL_PORT_3306_TCP_PORT=3306 -e MYSQL_INSTANCE_NAME=mindoc -e MYSQL_USERNAME=root -e MYSQL_PASSWORD=123456 -e httpport=8181 -d daocloud.io/lifei6671/mindoc:latest ``` +#### dockerfile内容参考 +- [无需代理直接加速各种 GitHub 资源拉取 | 国内镜像赋能 | 助力开发](https://blog.frytea.com/archives/504/) +- [阿里云 - Ubuntu 镜像](https://developer.aliyun.com/mirror/ubuntu) + ### docker-compose 一键安装 1. 修改配置文件