fix dockerfile for go-sqlite3

This commit is contained in:
c9s 2023-02-25 03:15:34 +08:00
parent 6f30b4551c
commit 4f0c986709
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54
2 changed files with 6 additions and 2 deletions

View File

@ -3,3 +3,5 @@
/linode /linode
/frontend /frontend
/desktop /desktop
/data
/output

View File

@ -1,9 +1,10 @@
# First stage container # First stage container
FROM golang:1.18.10-alpine3.17 AS builder FROM golang:1.18.10-alpine3.17 AS builder
RUN apk add --no-cache git ca-certificates gcc libc-dev pkgconfig RUN apk add --no-cache git ca-certificates gcc musl-dev libc-dev pkgconfig
# gcc is for github.com/mattn/go-sqlite3 # gcc is for github.com/mattn/go-sqlite3
# ADD . $GOPATH/src/github.com/c9s/bbgo # 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 ARG GO_MOD_CACHE
ENV WORKDIR=$GOPATH/src/github.com/c9s/bbgo ENV WORKDIR=$GOPATH/src/github.com/c9s/bbgo
@ -11,8 +12,9 @@ ENV GOPATH_ORIG=$GOPATH
ENV GOPATH=${GO_MOD_CACHE:+$WORKDIR/$GO_MOD_CACHE} ENV GOPATH=${GO_MOD_CACHE:+$WORKDIR/$GO_MOD_CACHE}
ENV GOPATH=${GOPATH:-$GOPATH_ORIG} ENV GOPATH=${GOPATH:-$GOPATH_ORIG}
ENV CGO_ENABLED=1 ENV CGO_ENABLED=1
RUN cd $WORKDIR && go get github.com/mattn/go-sqlite3 RUN cd $WORKDIR
ADD . . ADD . .
RUN go get github.com/mattn/go-sqlite3
RUN go build -o $GOPATH_ORIG/bin/bbgo ./cmd/bbgo RUN go build -o $GOPATH_ORIG/bin/bbgo ./cmd/bbgo
# Second stage container # Second stage container