-
Notifications
You must be signed in to change notification settings - Fork 59
/
Dockerfile
43 lines (39 loc) · 1.28 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
33
34
35
36
37
38
39
40
41
42
43
FROM golang:latest as builder
MAINTAINER <284077319@qq.com>
WORKDIR /go/src/github.com/jicg/liteblog
ENV GOPROXY=https://goproxy.cn
COPY . .
#ENV CGO_ENABLED=0
#RUN godep go build -installsuffix cgo -ldflags="-w -s"
RUN go get && go build -ldflags="-w -s"
#FROM scratch as final
FROM alpine as final
#FROM debian:latest as final
MAINTAINER <284077319@qq.com>
#COPY --from=builder /etc/passwd /etc/passwd
COPY --from=builder go/src/github.com/jicg/liteblog/liteblog /app/liteblog
COPY --from=builder go/src/github.com/jicg/liteblog/views /app/views
COPY --from=builder go/src/github.com/jicg/liteblog/static /app/static
COPY --from=builder go/src/github.com/jicg/liteblog/conf /app/conf
VOLUME /app/data
VOLUME /app/assert
EXPOSE 8080
WORKDIR /app
#RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
#&& echo 'Asia/Shanghai' >/etc/timezone \
#&& chmod +x start.sh
RUN apk --update upgrade && \
# sqlite
apk add sqlite && \
mkdir /lib64 && \
ln -s /lib/libc.musl-x86_64.so.1 /lib64/ld-linux-x86-64.so.2 && \
# 时间
apk add tzdata && \
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
echo "Asia/Shanghai" > /etc/timezone && \
# 清除缓存
rm -rf /var/cache/apk/* && \
# 执行权限
chmod +x liteblog
ENTRYPOINT ["/app/liteblog"]
CMD []