参考
命令:
代码语言:javascript复制docker build -t myleanote:1.0 .
docker run -it -v /home/leanote_data/data:/home/data -v /home/leanote_data/files:/home/leanote/files -p 9000:9000 -e NOTEHOST="https://note.superpig.win" --name leanote myleanote:1.0
注意:
将后台管理-configration-转换pdf
配置成xvfb-run wkhtmltopdf
dockerfile
代码语言:javascript复制FROM ubuntu:18.04
MAINTAINER yzh
RUN apt-get update && apt-get install -y
wget
xvfb libfontconfig wkhtmltopdf
#vim
RUN cd /home;mkdir data
RUN cd /home;wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.0.1.tgz;tar -xzvf mongodb-linux-x86_64-3.0.1.tgz
RUN cd /home;wget https://sourceforge.net/projects/leanote-bin/files/2.6.1/leanote-linux-amd64-v2.6.1.bin.tar.gz/download;mv download leanote-linux-amd64-v2.6.1.bin.tar.gz;tar -zxvf leanote-linux-amd64-v2.6.1.bin.tar.gz
RUN cd /home/;rm *.tar.gz;rm *.tgz
RUN cd /usr/share/fonts/truetype/dejavu/;wget https://github.com/sonatype/maven-guide-zh/raw/master/content-zh/src/main/resources/fonts/simsun.ttc
ENV PATH="${PATH}:/home/mongodb-linux-x86_64-3.0.1/bin"
ENV NOTEHOST="http://localhost:9000"
RUN ln -s /usr/bin/wkhtmltopdf /usr/local/bin/wkhtmltopdf
RUN echo "mongorestore -h localhost -d leanote --dir /home/leanote/mongodb_backup/leanote_install_data/" > /home/init.sh
RUN echo "cd /home/leanote/conf; sed -i 's@http://localhost:9000@'"$NOTEHOST"'@g' app.conf" > /home/runall.sh
RUN echo "nohup mongod --dbpath /home/data --smallfiles &" >> /home/runall.sh
RUN echo "sleep 3" >> /home/runall.sh
RUN echo "cd /home;bash init.sh" >> /home/runall.sh
RUN echo "cd /home;echo '# mongorestore -h localhost -d leanote --dir /home/leanote/mongodb_backup/leanote_install_data/'>init.sh " >> /home/runall.sh
RUN echo "cd /home/leanote/bin;" >> /home/runall.sh
RUN echo "sleep 3" >> /home/runall.sh
RUN echo "bash run.sh" >> /home/runall.sh
CMD ["/bin/bash", "/home/runall.sh"]