speed up building docker image

By using gx install --local, deps are copied into
the build context and therefore only stale deps
will get pulled from the network on image build.

License: MIT
Signed-off-by: Adrian Lanzafame <adrianlanzafame92@gmail.com>
This commit is contained in:
Adrian Lanzafame 2018-09-07 12:08:17 +10:00
parent 753322cdc1
commit 88f08e86b0
No known key found for this signature in database
GPG Key ID: 87E40C5D62EAE192
3 changed files with 13 additions and 1 deletions

1
.gitignore vendored
View File

@ -6,6 +6,7 @@ deptools
sharness/lib/sharness
sharness/test-results
sharness/trash*
vendor/
raftFolderFromTest*
peerstore

View File

@ -8,7 +8,7 @@ ENV SRC_PATH $GOPATH/src/github.com/ipfs/ipfs-cluster
COPY . $SRC_PATH
WORKDIR $SRC_PATH
RUN make install
RUN make docker_install
ENV SUEXEC_VERSION v0.2
ENV TINI_VERSION v0.16.1

View File

@ -28,6 +28,10 @@ install: deps
$(MAKE) -C ipfs-cluster-service install
$(MAKE) -C ipfs-cluster-ctl install
docker_install: docker_deps
$(MAKE) -C ipfs-cluster-service install
$(MAKE) -C ipfs-cluster-ctl install
build: deps
go build -ldflags "-X ipfscluster.Commit=$(shell git rev-parse HEAD)"
$(MAKE) -C ipfs-cluster-service build
@ -64,6 +68,13 @@ deps: gx
$(gx_bin) install --global
$(gx-go_bin) rewrite
# Run this target before building the docker image
# and then gx won't attempt to pull all deps
# from the network each time
docker_deps: gx
$(gx_bin) install --local
$(gx-go_bin) rewrite
check:
go vet ./...
golint -set_exit_status -min_confidence 0.3 ./...