forked from siyuan-note/siyuan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
32 lines (27 loc) · 1.37 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
FROM node:16 as NODE_BUILD
WORKDIR /go/src/github.com/siyuan-note/siyuan/
ADD . /go/src/github.com/siyuan-note/siyuan/
RUN rm /go/src/github.com/siyuan-note/siyuan/app/package-lock.json
RUN cd app && npm install --legacy-peer-deps && npm run build
FROM golang:alpine as GO_BUILD
WORKDIR /go/src/github.com/siyuan-note/siyuan/
COPY --from=NODE_BUILD /go/src/github.com/siyuan-note/siyuan/ /go/src/github.com/siyuan-note/siyuan/
ENV GO111MODULE=on
ENV CGO_ENABLED=1
RUN apk add --no-cache gcc musl-dev git && \
cd kernel && go build --tags fts5 -v -ldflags "-s -w -X github.com/siyuan-note/siyuan/kernel/util.Mode=prod" && \
mkdir /opt/siyuan/ && \
mv /go/src/github.com/siyuan-note/siyuan/app/appearance/ /opt/siyuan/ && \
mv /go/src/github.com/siyuan-note/siyuan/app/stage/ /opt/siyuan/ && \
mv /go/src/github.com/siyuan-note/siyuan/app/guide/ /opt/siyuan/ && \
mv /go/src/github.com/siyuan-note/siyuan/kernel/kernel /opt/siyuan/ && \
find /opt/siyuan/ -name .git | xargs rm -rf
FROM alpine:latest
LABEL maintainer="Liang Ding<845765@qq.com>"
WORKDIR /opt/siyuan/
COPY --from=GO_BUILD /opt/siyuan/ /opt/siyuan/
RUN addgroup --gid 1000 siyuan && adduser --uid 1000 --ingroup siyuan --disabled-password siyuan && apk add --no-cache ca-certificates tzdata && chown -R siyuan:siyuan /opt/siyuan/
ENV TZ=Asia/Shanghai
EXPOSE 6806
USER siyuan
ENTRYPOINT [ "/opt/siyuan/kernel" ]