fix dockerfile

This commit is contained in:
c9s 2021-12-27 18:22:54 +08:00
parent 9dc4106c9e
commit f0f207ed98

View File

@ -2,9 +2,7 @@
FROM golang:1.15-alpine3.12 AS builder
RUN apk add --no-cache git ca-certificates gcc libc-dev pkgconfig
# gcc is for github.com/mattn/go-sqlite3
RUN go get -u github.com/c9s/goose/cmd/goose
# ADD . $GOPATH/src/github.com/c9s/bbgo
# WORKDIR $GOPATH/src/github.com/c9s/bbgo
WORKDIR $GOPATH/src/github.com/c9s/bbgo
ARG GO_MOD_CACHE
@ -12,6 +10,8 @@ ENV WORKDIR=$GOPATH/src/github.com/c9s/bbgo
ENV GOPATH_ORIG=$GOPATH
ENV GOPATH=${GO_MOD_CACHE:+$WORKDIR/$GO_MOD_CACHE}
ENV GOPATH=${GOPATH:-$GOPATH_ORIG}
ENV CGO_ENABLED=1
RUN go get github.com/mattn/go-sqlite3
ADD . .
RUN go build -o $GOPATH_ORIG/bin/bbgo ./cmd/bbgo
@ -22,7 +22,6 @@ FROM alpine:3.12
RUN mkdir /app
WORKDIR /app
COPY --from=builder /go/bin/goose /usr/local/bin
COPY --from=builder /go/bin/bbgo /usr/local/bin
ENTRYPOINT ["/usr/local/bin/bbgo"]