Orange-OpenSource / optisam-backend

OpTISAM (Optimized tool for inventive software asset management) is a tool for the Software Asset Management Compliance Audit and Optimization Tool. This monorepo contains all the backend services
Apache License 2.0
20 stars 7 forks source link

Docker Build Fails on Account Service #1

Closed sweeny-here closed 4 years ago

sweeny-here commented 4 years ago

Hi - I've had to update the Go modules via

qwerty@qwerty-mbp > pwd
/Users/qwerty/Hme/Tek/LAC/sam/optisam-backend

qwerty@qwerty-mbp > go clean -modcache && go clean -cache

qwerty@qwerty-mbp > go mod tidy

The updated modules file is:

qwerty@qwerty-mbp > cat go.mod
module optisam-backend

go 1.14

require (
    contrib.go.opencensus.io/exporter/jaeger v0.1.0
    contrib.go.opencensus.io/exporter/prometheus v0.1.0
    contrib.go.opencensus.io/integrations/ocsql v0.1.6
    github.com/InVisionApp/go-health v2.1.0+incompatible
    github.com/InVisionApp/go-logger v1.0.1 // indirect
    github.com/Microsoft/go-winio v0.4.14 // indirect
    github.com/dgraph-io/badger v1.6.1
    github.com/dgraph-io/dgo v1.0.0
    github.com/dgraph-io/dgraph v1.2.5
    github.com/dgrijalva/jwt-go v3.2.0+incompatible
    github.com/docker/distribution v2.7.1+incompatible // indirect
    github.com/docker/docker v1.13.1
    github.com/docker/go-connections v0.4.0
    github.com/envoyproxy/protoc-gen-validate v0.4.0
    github.com/golang/mock v1.3.1
    github.com/golang/protobuf v1.4.2
    github.com/grpc-ecosystem/go-grpc-middleware v1.2.0
    github.com/grpc-ecosystem/grpc-gateway v1.14.6
    github.com/julienschmidt/httprouter v1.3.0
    github.com/lib/pq v1.7.1 // indirect
    github.com/opencensus-integrations/ocsql v0.1.6
    github.com/pkg/errors v0.9.1
    github.com/rs/cors v1.7.0
    github.com/spf13/afero v1.3.2 // indirect
    github.com/spf13/cobra v1.0.0
    github.com/spf13/pflag v1.0.5
    github.com/spf13/viper v1.7.0
    github.com/stretchr/testify v1.5.1
    github.com/vijay1811/pq v1.2.2
    go.opencensus.io v0.22.4
    go.uber.org/zap v1.15.0
    golang.org/x/net v0.0.0-20200707034311-ab3426394381
    golang.org/x/text v0.3.3 // indirect
    golang.org/x/tools v0.0.0-20200725200936-102e7d357031 // indirect
    google.golang.org/genproto v0.0.0-20200726014623-da3ae01ef02d
    google.golang.org/grpc v1.29.1
    google.golang.org/protobuf v1.25.0 // indirect
    gopkg.in/DATA-DOG/go-sqlmock.v1 v1.3.0 // indirect
    gopkg.in/oauth2.v3 v3.12.0
    gopkg.in/yaml.v2 v2.3.0 // indirect
)

Then I tired to build the account service but it errors out on:

qwerty@qwerty-mbp > pwd
/Users/qwerty/Hme/Tek/LAC/sam/optisam-backend/account-service/cmd/server

qwerty@qwerty-mbp > docker build --pull -t optisam/account-service:latest -f Dockerfile .
Sending build context to Docker daemon  6.656kB
Step 1/6 : FROM ubuntu
latest: Pulling from library/ubuntu
Digest: sha256:5d1d5407f353843ecf8b16524bc5565aa332e9e6a1297c73a92d3e754b8a636d
Status: Image is up to date for ubuntu:latest
 ---> 1e4467b07108
Step 2/6 : WORKDIR /usr/local/bin
 ---> Using cache
 ---> f6df20af97be
Step 3/6 : ADD server .
ADD failed: stat /var/lib/docker/tmp/docker-builder135837665/server: no such file or directory

In order to generate the server file which the Dockerfile needs, I've tried to build the local Goloang file, like so:

qwerty@qwerty-mbp > go build
# optisam-backend/account-service/pkg/api/v1
../../pkg/api/v1/account.pb.gw.go:107:3: undefined: runtime.CamelCaseFieldMask
../../pkg/api/v1/account.pb.gw.go:109:56: not enough arguments in call to runtime.FieldMaskFromRequestBody
    have (io.Reader)
    want (io.Reader, *descriptorpb.DescriptorProto)

Can you offer any pointers on this?

Theo

sweeny-here commented 4 years ago

Fix - it is now working. In addition to the above changes, also run:

go get -u github.com/grpc-ecosystem/grpc-gateway/runtime
cd optisam-backend/account-service/cmd/server/
go install
go fix
go build