From da2ed56ae138c5687c205d39d4aa00d3cec71824 Mon Sep 17 00:00:00 2001 From: Hugo Labrador Date: Thu, 22 Aug 2019 06:57:05 +0200 Subject: [PATCH] build: enable multiple Dockerfiles (#211) --- Dockerfile.reva | 28 ++++++++++++++++++++++++++++ Dockerfile => Dockerfile.revad | 4 ++-- Makefile | 12 +++++++++++- README.md | 9 +-------- 4 files changed, 42 insertions(+), 11 deletions(-) create mode 100644 Dockerfile.reva rename Dockerfile => Dockerfile.revad (98%) diff --git a/Dockerfile.reva b/Dockerfile.reva new file mode 100644 index 0000000000..af2b7b7513 --- /dev/null +++ b/Dockerfile.reva @@ -0,0 +1,28 @@ +# Copyright 2018-2019 CERN +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# In applying this license, CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization +# or submit itself to any jurisdiction. + +FROM golang:1.11 + +WORKDIR /go/src/github/cs3org/reva +COPY . . +RUN GO111MODULE=off make deps +ENV GO111MODULE=on +RUN make build-reva +WORKDIR /go/src/github/cs3org/reva/cmd/reva +RUN go install +ENTRYPOINT ["/go/bin/reva"] diff --git a/Dockerfile b/Dockerfile.revad similarity index 98% rename from Dockerfile rename to Dockerfile.revad index f10fe8d02a..ffd9741a4b 100644 --- a/Dockerfile +++ b/Dockerfile.revad @@ -18,11 +18,11 @@ FROM golang:1.11 -ENV GO111MODULE=on WORKDIR /go/src/github/cs3org/reva COPY . . RUN GO111MODULE=off make deps -RUN make +ENV GO111MODULE=on +RUN make build-revad WORKDIR /go/src/github/cs3org/reva/cmd/revad RUN go install RUN mkdir -p /etc/revad/ diff --git a/Makefile b/Makefile index 157d7022e8..c08aa7d40d 100644 --- a/Makefile +++ b/Makefile @@ -17,6 +17,16 @@ build: go build -o ./cmd/revad/revad ${LDFLAGS} ./cmd/revad go build -o ./cmd/reva/reva ${LDFLAGS} ./cmd/reva +build-revad: + go build ./... + go mod tidy + go build -o ./cmd/revad/revad ${LDFLAGS} ./cmd/revad + +build-reva: + go build ./... + go mod tidy + go build -o ./cmd/revad/revad ${LDFLAGS} ./cmd/revad + test: go test -race ./... @@ -37,5 +47,5 @@ deploy: ./cmd/revad/revad -c ./cmd/revad/revad.toml -p ./cmd/revad/revad.pid deps: cd /tmp && go get -u golang.org/x/lint/golint - cd /tmp && GO111MODULE=on go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.17.1 + cd /tmp && go get github.com/golangci/golangci-lint/cmd/golangci-lint cd /tmp && go get -u golang.org/x/tools/cmd/goimports diff --git a/README.md b/README.md index d29b0572a1..4c121463d5 100644 --- a/README.md +++ b/README.md @@ -32,14 +32,7 @@ You can also read the [build from sources guide](https://cs3org.github.io/reva/b ## Run it using Docker -``` -$ git clone https://github.com/cs3org/reva -$ cd reva -$ docker build . -t revad -$ docker run -p 9999:9999 -p 9998:9998 -d revad -# or provide your own config -# $ docker run -p 9999:9999 -p 9998:9998 -v /your/config:/etc/revad/revad.toml -d revad -``` +See [https://hub.docker.com/r/cs3org/reva](https://hub.docker.com/r/cs3org/reva). ## Plugin development