mindoc-org / mindoc

Golang实现的基于beego框架的接口在线文档管理系统
https://mindoc.com.cn/docs/mindochelp
Apache License 2.0
7.29k stars 1.9k forks source link

分享一下,修复DOCKER镜像下载问题 #768

Open yayaw opened 2 years ago

yayaw commented 2 years ago

请按照一下格式提交issue,谢谢!

  1. 你当前使用的是哪个版本的 MinDoc(godoc_linux_amd64 version)?

把最新版本,重新打包了,特别是镜像无法下载文件,现在用这种方式,直接可以运行,需要把conf这个文件夹先放到/data/minidoc/conf,并配置好,即可。 version: '3.7' services: mindoc: image: registry.cn-hangzhou.aliyuncs.com/ok/mindoc:latest privileged: false restart: always ports:

  1. 你当前使用的是什么操作系统? centos7

另外源码修复二个模版本问题,可以直接拿着镜像用 dockerfile FROM ubuntu:focal SHELL ["/bin/bash", "-c"] WORKDIR /mindoc RUN apt-get update RUN apt install -y apt-transport-https ca-certificates curl wget xz-utils ENV TZ=Asia/Shanghai RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone ARG DEBIAN_FRONTEND=noninteractive RUN apt install -y --no-install-recommends tzdata RUN dpkg-reconfigure --frontend noninteractive tzdata RUN apt install -y libgl-dev libnss3-dev libxcomposite-dev libxrandr-dev libxi-dev libxdamage1 RUN apt install -y fonts-wqy-microhei fonts-wqy-zenhei RUN apt-get install -y locales language-pack-zh-hans language-pack-zh-hans-base RUN locale-gen "zh_CN.UTF-8" RUN update-locale LANG=zh_CN.UTF-8 ENV LANG=zh_CN.UTF-8 ENV LANGUAGE=zh_CN:en ENV LC_ALL=zh_CN.UTF-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 mkdir -p /opt/calibre RUN tar xJof /tmp/calibre-cache/calibre-x86_64.txz -C /opt/calibre ENV PATH=$PATH:/opt/calibre ENV QTWEBENGINE_CHROMIUM_FLAGS="--no-sandbox" ENV QT_QPA_PLATFORM='offscreen' ENV ZONEINFO=/mindoc/lib/time/zoneinfo.zip RUN ebook-convert --version RUN rm -rf /tmp/calibre-cache ADD simsun.ttc /usr/share/fonts/win/ RUN chmod a+r /usr/share/fonts/win/simsun.ttc ADD static/ /mindoc/static/ ADD views/ /mindoc/views ADD conf /mindoc/conf ADD mindoc_linux_amd64 start.sh sync_host.sh /mindoc/ RUN chmod +x /mindoc/start.sh VOLUME /mindoc-sync-host EXPOSE 8181/tcp ENTRYPOINT ["/bin/bash", "/mindoc/start.sh"]

wicever commented 2 years ago

每太明白,请教下: 1、中描述的是docker-compose.yml的内容吗? 2、中描述的是Dockerfile里第二阶段FROM ubuntu的内容前面部分不变?

然后基于此修改通过docker build -t xxx .打包docke镜像? 启动容器命令有什么特殊的吗? 您是连mysql还是什么数据库?

yayaw commented 2 years ago

每太明白,请教下: 1、中描述的是docker-compose.yml的内容吗? 2、中描述的是Dockerfile里第二阶段FROM ubuntu的内容前面部分不变?

然后基于此修改通过docker build -t xxx .打包docke镜像? 启动容器命令有什么特殊的吗? 您是连mysql还是什么数据库?

1、你说的是对的,是docker-compose.yml 这个配置,主要解决了,导出后生成的缓存文件被删除,不然重置docker后,又要二次生成 还有把备份,放到容器外面,不然每次重启,要重生成。 2、Dockerfile是第二阶段的,哪个编译过程是在centos下进行的,可自行编译 3、如果想自己打包,请参考以 下内容 TAG=0.0.1 GO111MODULE=on CGO_ENABLED=1 GOARCH=amd64 GOOS=linux go build -o mindoc_linux_amd64 -ldflags "-w -s -X 'main.VERSION=$TAG' -X 'main.BUILD_TIME=date' -X 'main.GO_VERSION=go version'" docker build . -t registry.cn-hangzhou.aliyuncs.com/ok/mindoc:latest docker push registry.cn-hangzhou.aliyuncs.com/ok/mindoc:latest 4、这个配置文件,自行配置吧,不配置,默认就用的是SQLITE.