Fix docker build

This commit is contained in:
cuigh 2018-12-19 14:49:15 +08:00
parent 6090e86fee
commit 24d8dfaced

View File

@ -1,5 +1,6 @@
FROM golang:alpine AS build FROM golang:alpine AS build
WORKDIR /go/src/github.com/cuigh/swirl/ RUN apk add git
WORKDIR /go/src/swirl/
ADD . . ADD . .
ENV GO111MODULE on ENV GO111MODULE on
RUN CGO_ENABLED=0 go build -ldflags "-s -w" RUN CGO_ENABLED=0 go build -ldflags "-s -w"
@ -8,9 +9,9 @@ FROM alpine:3.8
LABEL maintainer="cuigh <noname@live.com>" LABEL maintainer="cuigh <noname@live.com>"
WORKDIR /app WORKDIR /app
RUN apk add --no-cache ca-certificates RUN apk add --no-cache ca-certificates
COPY --from=build /go/src/github.com/cuigh/swirl/swirl . COPY --from=build /go/src/swirl/swirl .
COPY --from=build /go/src/github.com/cuigh/swirl/config ./config/ COPY --from=build /go/src/swirl/config ./config/
COPY --from=build /go/src/github.com/cuigh/swirl/assets ./assets/ COPY --from=build /go/src/swirl/assets ./assets/
COPY --from=build /go/src/github.com/cuigh/swirl/views ./views/ COPY --from=build /go/src/swirl/views ./views/
EXPOSE 8001 EXPOSE 8001
ENTRYPOINT ["/app/swirl"] ENTRYPOINT ["/app/swirl"]