Merge pull request #946 from ipfs/dockerfiles-improvs

Dockerfiles: download modules in advance
This commit is contained in:
Hector Sanjuan 2019-11-05 12:27:51 +01:00 committed by GitHub
commit dcb6c0805b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 23 additions and 13 deletions

View File

@ -8,10 +8,6 @@ ENV SRC_PATH $GOPATH/src/github.com/ipfs/ipfs-cluster
ENV GO111MODULE on
ENV GOPROXY=https://proxy.golang.org
COPY . $SRC_PATH
WORKDIR $SRC_PATH
RUN make install
ENV SUEXEC_VERSION v0.2
ENV TINI_VERSION v0.16.1
RUN set -x \
@ -27,6 +23,14 @@ RUN set -x \
# Get the TLS CA certificates, they're not provided by busybox.
RUN apt-get update && apt-get install -y ca-certificates
COPY go.* $SRC_PATH/
WORKDIR $SRC_PATH
RUN go mod download
COPY . $SRC_PATH
RUN make install
#------------------------------------------------------
FROM busybox:1-glibc
MAINTAINER Hector Sanjuan <hector@protocol.ai>

View File

@ -7,9 +7,14 @@ MAINTAINER Hector Sanjuan <hector@protocol.ai>
# This builder just builds the cluster binaries
ENV GOPATH /go
ENV SRC_PATH $GOPATH/src/github.com/ipfs/ipfs-cluster
ENV GO111MODULE on
ENV GOPROXY=https://proxy.golang.org
COPY go.* $SRC_PATH/
WORKDIR $SRC_PATH
RUN go mod download
COPY . $SRC_PATH
WORKDIR $SRC_PATH
RUN make install
#------------------------------------------------------

View File

@ -8,14 +8,16 @@ ENV SRC_PATH $GOPATH/src/github.com/ipfs/ipfs-cluster
ENV GO111MODULE on
ENV GOPROXY=https://proxy.golang.org
COPY . $SRC_PATH
WORKDIR $SRC_PATH
RUN make install
RUN cd /tmp && \
wget https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64 && \
chmod +x jq-linux64
COPY go.* $SRC_PATH/
WORKDIR $SRC_PATH
RUN go mod download
COPY . $SRC_PATH
RUN make install
#------------------------------------------------------
FROM ipfs/go-ipfs:master

View File

@ -14,7 +14,6 @@ install:
$(MAKE) -C cmd/ipfs-cluster-ctl install
build:
go build -ldflags "-X ipfscluster.Commit=$(shell git rev-parse HEAD)"
$(MAKE) -C cmd/ipfs-cluster-service build
$(MAKE) -C cmd/ipfs-cluster-ctl build

View File

@ -4,7 +4,7 @@ SRC := $(shell find .. -type f -name '*.go')
all: ipfs-cluster-ctl
ipfs-cluster-ctl: $(SRC)
go build
go build -mod=readonly
build: ipfs-cluster-ctl

View File

@ -4,7 +4,7 @@ SRC := $(shell find .. -type f -name '*.go')
all: ipfs-cluster-service
ipfs-cluster-service: $(SRC)
go build -ldflags "-X main.commit=$(shell git rev-parse HEAD)"
go build -mod=readonly -ldflags "-X main.commit=$(shell git rev-parse HEAD)"
build: ipfs-cluster-service