mindoc/Dockerfile

95 lines
3.4 KiB
Docker
Raw Normal View History

2019-01-15 20:25:11 +08:00
FROM golang:1.11.4-alpine3.8 AS build
2018-07-12 18:38:29 +08:00
#新增 GLIBC
2018-08-14 18:47:52 +08:00
ENV GLIBC_VERSION "2.28-r0"
2018-07-12 18:38:29 +08:00
# Download and install glibc
RUN apk add --update && \
apk add --no-cache --upgrade \
ca-certificates \
gcc \
g++ \
make \
curl \
git
2017-05-01 13:11:33 +08:00
2018-08-14 18:50:16 +08:00
RUN curl -Lo /etc/apk/keys/sgerrand.rsa.pub "https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub" && \
curl -Lo /var/glibc.apk "https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/glibc-${GLIBC_VERSION}.apk" && \
2018-07-12 18:38:29 +08:00
curl -Lo /var/glibc-bin.apk "https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/glibc-bin-${GLIBC_VERSION}.apk" && \
apk add /var/glibc-bin.apk /var/glibc.apk && \
/usr/glibc-compat/sbin/ldconfig /lib /usr/glibc-compat/lib && \
echo 'hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4' >> /etc/nsswitch.conf
#掛載 calibre 最新3.x
ENV LD_LIBRARY_PATH $LD_LIBRARY_PATH:/opt/calibre/lib
ENV PATH $PATH:/opt/calibre/bin
RUN curl -Lo /var/linux-installer.py https://download.calibre-ebook.com/linux-installer.py
#RUN mkdir -p /go/src/github.com/lifei6671/ && cd /go/src/github.com/lifei6671/ && git clone https://github.com/mindoc-org/mindoc.git && cd mindoc
2018-07-18 17:56:33 +08:00
ADD . /go/src/github.com/mindoc-org/mindoc
WORKDIR /go/src/github.com/mindoc-org/mindoc
2018-07-12 18:38:29 +08:00
RUN go get -u github.com/golang/dep/cmd/dep && dep ensure && \
CGO_ENABLE=1 go build -v -a -o mindoc_linux_amd64 -ldflags="-w -s -X main.VERSION=$TAG -X 'main.BUILD_TIME=`date`' -X 'main.GO_VERSION=`go version`'" && \
2018-07-18 17:56:33 +08:00
rm -rf commands controllers models modules routers tasks vendor docs search data utils graphics .git Godeps uploads/* .gitignore .travis.yml Dockerfile gide.yaml LICENSE main.go README.md conf/enumerate.go conf/mail.go install.lock simsun.ttc
2018-07-12 18:38:29 +08:00
ADD start.sh /go/src/github.com/mindoc-org/mindoc
2018-07-26 17:50:52 +08:00
ADD simsun.ttc /usr/share/fonts/win/
2018-02-03 17:22:50 +08:00
2018-06-06 12:09:24 +08:00
FROM alpine:latest
2018-07-12 18:38:29 +08:00
2018-07-11 10:46:32 +08:00
LABEL maintainer="longfei6671@163.com"
2018-07-12 18:38:29 +08:00
RUN apk add --update && \
apk add --no-cache --upgrade \
2019-03-11 15:01:11 +08:00
tzdata \
2018-07-12 18:38:29 +08:00
mesa-gl \
python \
qt5-qtbase-x11 \
xdg-utils \
libxrender \
libxcomposite \
xz \
imagemagick \
imagemagick-dev \
msttcorefonts-installer \
fontconfig && \
update-ms-fonts && \
fc-cache -f
2018-09-17 17:07:58 +08:00
COPY --from=build /var/glibc.apk .
COPY --from=build /var/glibc-bin.apk .
COPY --from=build /etc/apk/keys/sgerrand.rsa.pub /etc/apk/keys/sgerrand.rsa.pub
COPY --from=build /var/linux-installer.py .
COPY --from=build /usr/share/fonts/win/simsun.ttc /usr/share/fonts/win/
2018-09-17 17:44:55 +08:00
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=build /go/src/github.com/mindoc-org/mindoc /mindoc
2018-07-12 18:38:29 +08:00
RUN apk add glibc-bin.apk glibc.apk && \
/usr/glibc-compat/sbin/ldconfig /lib /usr/glibc-compat/lib && \
echo 'hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4' >> /etc/nsswitch.conf && \
2018-07-26 17:50:52 +08:00
rm -rf glibc.apk glibc-bin.apk /var/cache/apk/* && \
chmod a+r /usr/share/fonts/win/simsun.ttc
2018-07-12 18:38:29 +08:00
ENV LD_LIBRARY_PATH $LD_LIBRARY_PATH:/opt/calibre/lib
ENV PATH $PATH:/opt/calibre/bin
RUN cat linux-installer.py | python -c "import sys; main=lambda x,y:sys.stderr.write('Download failed\n'); exec(sys.stdin.read()); main(install_dir='/opt', isolated=True)" && \
rm -rf /tmp/* linux-installer.py
2018-06-06 11:43:25 +08:00
WORKDIR /mindoc
2018-07-12 18:38:29 +08:00
# 时区设置
ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
2018-07-12 18:38:29 +08:00
2018-06-27 15:10:01 +08:00
ENV ZONEINFO=/mindoc/lib/time/zoneinfo.zip
2018-06-06 11:43:25 +08:00
RUN chmod +x start.sh
2018-02-03 17:22:50 +08:00
CMD ["./start.sh"]