fix docker mod cache

This commit is contained in:
c9s 2020-12-17 16:19:31 +08:00
parent 9e1476dcb1
commit 2efdf82915
3 changed files with 15 additions and 2 deletions

View File

@ -3,12 +3,16 @@ 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
# 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
ENV WORKDIR=$GOPATH/src/github.com/c9s/bbgo
ENV GOPATH_ORIG=$GOPATH
ENV GOPATH=${GO_MOD_CACHE:+$PWD/$GO_MOD_CACHE}
ENV GOPATH=${GO_MOD_CACHE:+$WORKDIR/$GO_MOD_CACHE}
ENV GOPATH=${GOPATH:-$GOPATH_ORIG}
ADD . .
RUN go build -o $GOPATH_ORIG/bin/bbgo ./cmd/bbgo
# Second stage container

View File

@ -30,5 +30,6 @@ dist: bin-dir bbgo-linux bbgo-darwin
docker:
GOPATH=$(PWD)/.mod go mod download
docker build --build-arg GO_MOD_CACHE=.mod --tag yoanlin/bbgo .
bash -c "[[ -n $(DOCKER_TAG) ]] && docker tag yoanlin/bbgo yoanlin/bbgo:$(DOCKER_TAG)"
.PHONY: dist

View File

@ -233,6 +233,14 @@ streambook.BindStream(stream)
## Helm Chart
Prepare your docker image locally (you can also use the docker image from docker hub):
```
make docker DOCKER_TAG=1.16.0
```
The docker tag version number is from the file [Chart.yaml](charts/bbgo/Chart.yaml)
Prepare your secret:
```