generated from networkservicemesh/cmd-template
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add main.go and supporting materials (#1)
Signed-off-by: Ed Warnicke <[email protected]>
- Loading branch information
1 parent
2253d9c
commit 39d5ebd
Showing
11 changed files
with
1,050 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
README.md | ||
.github/workflows/update-cmd-repositories.yaml | ||
.github/workflows/update-cmd-repositories.yaml | ||
.golangci.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,31 @@ | ||
FROM golang:1.15-buster as go | ||
FROM ghcr.io/edwarnicke/govpp/vpp:20.09 as go | ||
COPY --from=golang:1.15.3-buster /usr/local/go/ /go | ||
ENV PATH ${PATH}:/go/bin | ||
ENV GO111MODULE=on | ||
ENV CGO_ENABLED=0 | ||
ENV GOBIN=/bin | ||
RUN go get github.com/go-delve/delve/cmd/[email protected] | ||
RUN go run github.com/edwarnicke/dl \ | ||
RUN rm -r /etc/vpp | ||
RUN go get github.com/go-delve/delve/cmd/[email protected] | ||
RUN go get github.com/edwarnicke/dl | ||
RUN dl \ | ||
https://github.com/spiffe/spire/releases/download/v0.9.3/spire-0.9.3-linux-x86_64-glibc.tar.gz | \ | ||
tar -xzvf - -C /bin --strip=3 ./spire-0.9.3/bin/spire-server ./spire-0.9.3/bin/spire-agent | ||
|
||
FROM go as build | ||
WORKDIR /build | ||
COPY go.mod go.sum ./ | ||
COPY ./local ./local | ||
COPY ./internal/imports ./internal/imports | ||
RUN go build ./internal/imports | ||
COPY . . | ||
RUN go build -o /bin/app . | ||
RUN go build -o /bin/forwarder . | ||
|
||
FROM build as test | ||
CMD go test -test.v ./... | ||
|
||
FROM test as debug | ||
CMD dlv -l :40000 --headless=true --api-version=2 test -test.v ./... | ||
|
||
FROM alpine as runtime | ||
COPY --from=build /bin/app /bin/app | ||
CMD /bin/app | ||
FROM ghcr.io/edwarnicke/govpp/vpp:20.09 as runtime | ||
COPY --from=build /bin/forwarder /bin/forwarder | ||
CMD /bin/forwarder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,20 @@ | ||
module github.com/networkservicemesh/cmd-template | ||
|
||
go 1.15 | ||
|
||
require ( | ||
github.com/antonfisher/nested-logrus-formatter v1.3.0 | ||
github.com/edwarnicke/debug v1.0.0 | ||
github.com/edwarnicke/grpcfd v0.0.0-20201107002751-f220aed0c5c8 | ||
github.com/edwarnicke/log v1.0.0 | ||
github.com/edwarnicke/signalctx v0.0.0-20201105214533-3a35840b3011 | ||
github.com/edwarnicke/vpphelper v0.0.0-20201118000727-c5667bc2b1a4 | ||
github.com/golang/protobuf v1.4.3 | ||
github.com/kelseyhightower/envconfig v1.4.0 | ||
github.com/networkservicemesh/api v0.0.0-20201117093615-ae6039374f31 | ||
github.com/networkservicemesh/sdk v0.0.0-20201118101019-1866c4819823 | ||
github.com/networkservicemesh/sdk-vpp v0.0.0-20201118180433-1079138cd080 | ||
github.com/sirupsen/logrus v1.7.0 | ||
github.com/spiffe/go-spiffe/v2 v2.0.0-beta.2 | ||
google.golang.org/grpc v1.33.2 | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright (c) 2020 Cisco and/or its affiliates. | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
// 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. | ||
|
||
package imports | ||
|
||
//go:generate bash -c "cd $(mktemp -d) && GO111MODULE=on go get github.com/edwarnicke/[email protected]" | ||
//go:generate bash -c "GOOS=linux ${GOPATH}/bin/imports-gen" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// DO NOT EDIT - generated by github.com/edwarnicke/imports-gen | ||
package imports | ||
|
||
import ( | ||
_ "context" | ||
_ "io/ioutil" | ||
_ "net" | ||
_ "net/url" | ||
_ "os" | ||
_ "path/filepath" | ||
_ "time" | ||
|
||
_ "github.com/antonfisher/nested-logrus-formatter" | ||
_ "github.com/edwarnicke/debug" | ||
_ "github.com/edwarnicke/grpcfd" | ||
_ "github.com/edwarnicke/log" | ||
_ "github.com/edwarnicke/signalctx" | ||
_ "github.com/edwarnicke/vpphelper" | ||
_ "github.com/golang/protobuf/ptypes" | ||
_ "github.com/kelseyhightower/envconfig" | ||
_ "github.com/sirupsen/logrus" | ||
_ "github.com/spiffe/go-spiffe/v2/spiffetls/tlsconfig" | ||
_ "github.com/spiffe/go-spiffe/v2/workloadapi" | ||
_ "google.golang.org/grpc" | ||
_ "google.golang.org/grpc/credentials" | ||
|
||
_ "github.com/networkservicemesh/api/pkg/api/registry" | ||
_ "github.com/networkservicemesh/sdk-vpp/pkg/networkservice/chains/xconnectns" | ||
_ "github.com/networkservicemesh/sdk/pkg/networkservice/common/authorize" | ||
_ "github.com/networkservicemesh/sdk/pkg/registry/common/sendfd" | ||
_ "github.com/networkservicemesh/sdk/pkg/registry/core/chain" | ||
_ "github.com/networkservicemesh/sdk/pkg/tools/grpcutils" | ||
_ "github.com/networkservicemesh/sdk/pkg/tools/spiffejwt" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
* | ||
!.gitignore | ||
!README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
To work with a local dependent module, check out that module into this | ||
directory, and put the local replace into the main go.mod. | ||
|
||
Example: | ||
|
||
```bash | ||
cd local | ||
git clone [email protected]:edwarnicke/sdk.git | ||
cd sdk | ||
git remote add upstream [email protected]:networkservicemesh/sdk.git | ||
cd ../.. | ||
``` | ||
|
||
And then edit the go.mod file utilize a replace: | ||
|
||
```vgo | ||
module github.com/networkservicemesh/cmd-forwarder-vpp | ||
go 1.13 | ||
require ( | ||
... | ||
) | ||
replace github.com/networkservicemesh/sdk => ./local/sdk | ||
``` | ||
|
Oops, something went wrong.