Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
yayaw opened this issue Jan 24, 2022 · 2 comments
Open

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

yayaw opened this issue Jan 24, 2022 · 2 comments
Labels
feature-docker 功能特性-Docker

Comments

@yayaw
Copy link

yayaw commented Jan 24, 2022

请按照一下格式提交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:
- 8181:8181
volumes:
- /data/minidoc/conf:/mindoc/conf
- /data/minidoc/uploads:/mindoc/uploads
- /data/minidoc/sync:/mindoc-sync-host
- /data/minidoc/runtime:/mindoc/runtime

  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
Copy link

wicever commented Jan 24, 2022

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

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

@yayaw
Copy link
Author

yayaw commented Jan 24, 2022

每太明白,请教下: 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.

@gsw945 gsw945 added the feature-docker 功能特性-Docker label Feb 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-docker 功能特性-Docker
Projects
None yet
Development

No branches or pull requests

3 participants