Skip to content

Commit

Permalink
优化: docker使用alpine
Browse files Browse the repository at this point in the history
  • Loading branch information
jicg committed Jan 13, 2019
1 parent 523d5ca commit d97928a
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
#FROM scratch as final
FROM alpine as alpine_sqlite
RUN apk --update upgrade \
&& apk add sqlite
RUN mkdir /lib64 && ln -s /lib/libc.musl-x86_64.so.1 /lib64/ld-linux-x86-64.so.2
RUN rm -rf /var/cache/apk/*

FROM golang:latest as builder
MAINTAINER <[email protected]>
WORKDIR /go/src/github.com/jicg/liteblog
Expand All @@ -6,9 +13,9 @@ COPY . .
#ENV CGO_ENABLED=0
#RUN godep go build -installsuffix cgo -ldflags="-w -s"
RUN godep go build -ldflags="-w -s"
#FROM scratch as final
#FROM alpine as final
FROM debian:latest as final

FROM alpine_sqlite as final
#FROM debian:latest as final
MAINTAINER <[email protected]>

#COPY --from=builder /etc/passwd /etc/passwd
Expand All @@ -21,9 +28,11 @@ 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 \


#RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
#&& echo 'Asia/Shanghai' >/etc/timezone \
#&& chmod +x start.sh
&& chmod +x liteblog
RUN chmod +x liteblog
ENTRYPOINT ["/app/liteblog"]
CMD []

0 comments on commit d97928a

Please sign in to comment.