Skip to content

Commit

Permalink
Merge 7d380b7 into d7cdc1f
Browse files Browse the repository at this point in the history
  • Loading branch information
teone committed May 30, 2019
2 parents d7cdc1f + 7d380b7 commit 0174fab
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 15 deletions.
26 changes: 21 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@ export CGO_ENABLED=0

.PHONY: build

ONOS_CONFIG_VERSION := "latest"
ONOS_BUILD_VERSION := "stable"
ONOS_CONFIG_VERSION := latest
ONOS_BUILD_VERSION := stable

all: image

image: # @HELP build onos-config image
docker run -it -v `pwd`:/go/src/github.com/onosproject/onos-config onosproject/onos-config-build:${ONOS_BUILD_VERSION} protos build
docker build . -f build/onos-config/Dockerfile -t onosproject/onos-config:${ONOS_CONFIG_VERSION}
docker run --rm -it -v `pwd`:/go/src/github.com/onosproject/onos-config onosproject/onos-config-build:${ONOS_BUILD_VERSION} protos
docker build . -f build/onos-config/Dockerfile \
--build-arg ONOS_BUILD_VERSION=${ONOS_BUILD_VERSION} \
-t onosproject/onos-config:${ONOS_CONFIG_VERSION}

deps: # @HELP ensure that the required dependencies are in place
dep ensure -v
Expand All @@ -33,7 +35,7 @@ protos: # @HELP compile the protobuf files
./build/dev-docker/compile-protos.sh

build: # @HELP build the go binary in the cmd/onos-config package
build: test
build: protos test
export GOOS=linux
export GOARCH=amd64
go build -o build/_output/onos-config ./cmd/onos-config
Expand All @@ -51,6 +53,20 @@ run: # @HELP run mainline in cmd/onos-config
run: deps
go run cmd/onos-config/onos-config.go

run-docker: # @HELP run onos-config docker image
run-docker: image
docker run -d -p 5150:5150 -v `pwd`/configs:/etc/onos-config \
--name onos-config onosproject/onos-config \
-configStore=/etc/onos-config/configStore-sample.json \
-changeStore=/etc/onos-config/changeStore-sample.json \
-deviceStore=/etc/onos-config/deviceStore-sample.json \
-networkStore=/etc/onos-config/networkStore-sample.json

clean: # @HELP remove all the build artifacts
rm -rf ./build/_output
rm -rf ./vendor
rm -rf ./cmd/onos-config/onos-config

help:
@grep -E '^.*: *# *@HELP' $(MAKEFILE_LIST) \
| sort \
Expand Down
4 changes: 3 additions & 1 deletion build/onos-config/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
FROM onosproject/onos-config-build:stable as builder
ARG ONOS_BUILD_VERSION=stable

FROM onosproject/onos-config-build:$ONOS_BUILD_VERSION as builder
COPY . /go/src/github.com/onosproject/onos-config
RUN cd /go/src/github.com/onosproject/onos-config && make build

Expand Down
4 changes: 2 additions & 2 deletions docs/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ The project provides a `Makefile` that supports all the required to unit test,
validate and build the project.
The makefile supports the following targets:
* `test` - pulls dependencies and runs tests, including lint, vet and license
* `build` - runs `test` and builds an executable
* `all` - runs `test`, `build`, and creates the run-time `onosproject/onos-config` Docker image
* `build` - runs `protos`, `test` and builds an executable
* `all` - runs `protos`, and creates the run-time `onosproject/onos-config` Docker image
* Requires a local Docker daemon

## Building via Docker Developer Image
Expand Down
9 changes: 2 additions & 7 deletions docs/run.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,10 @@ go run github.com/onosproject/onos-config/cmd/onos-config \
## Run Server in Docker Image
Alternatively, to run onos-config via its Docker image like this:
```
docker run -p 5150:5150 -v `pwd`/configs:/etc/onos-config -it onosproject/onos-config \
-configStore=/etc/onos-config/configStore-sample.json \
-changeStore=/etc/onos-config/changeStore-sample.json \
-deviceStore=/etc/onos-config/deviceStore-sample.json \
-networkStore=/etc/onos-config/networkStore-sample.json
make run-docker
```
Note that the local config directory is mounted from the container to allow access to local
test configuration files. You can [build your own version of the onos-config Docker image](build.md)
or use the published one.
test configuration files. This command will build a docker image form source


## Northbound Get Request via gNMI
Expand Down

0 comments on commit 0174fab

Please sign in to comment.