infobloxopen / atlas-cli

Apache License 2.0
14 stars 45 forks source link

enable cgo, allowing for more performant net package #45

Closed drewwells closed 5 years ago

drewwells commented 5 years ago

Alpine installs libc in a location that Go is not looking for. As a result, it's not possible to run any cgo code. This changes binds libc to a location that Go can find.

drewwells commented 5 years ago

Do we have any tests covering Binary builds?

drewwells commented 5 years ago

DEMO

-> % go run atlas/main.go init-app -name boom                                                                                               env-2a-second
Generating protobuf files... done!
Starting dep project... done!
Resolving imports... done!
Initializing git repo... done!
[~/src/github.com/infobloxopen/atlas-cli] [feature/useCGO *]
-> % cd boom                                                                                                                                env-2a-second
[~/src/github.com/infobloxopen/atlas-cli/boom] [master]
-> % make                                                                                                                                   env-2a-second
Sending build context to Docker daemon  28.37MB
Step 1/10 : FROM golang:1.13.1 AS builder
 ---> 52b59e9ead8e
Step 2/10 : LABEL stage=server-intermediate
 ---> Using cache
 ---> bdd5a4d5f79a
Step 3/10 : WORKDIR /go/src/github.com/infobloxopen/atlas-cli/boom
 ---> Using cache
 ---> 428bc6dcc798
Step 4/10 : COPY . .
 ---> 50b801d7b868
Step 5/10 : RUN go build -o bin/server ./cmd/server
 ---> Running in 1034fc7a586a
Removing intermediate container 1034fc7a586a
 ---> 503de2fcd998
Step 6/10 : FROM alpine:latest AS runner
 ---> 5cb3aa00f899
Step 7/10 : WORKDIR /bin
 ---> Using cache
 ---> 9c17da7f50b6
Step 8/10 : RUN mkdir -p /lib64 &&     ln -s /lib/libc.musl-x86_64.so.1 /lib64/ld-linux-x86-64.so.2
 ---> Running in 0d54037728bf
Removing intermediate container 0d54037728bf
 ---> c4c31f556ec0
Step 9/10 : COPY --from=builder /go/src/github.com/infobloxopen/atlas-cli/boom/bin/server .
 ---> e1ed06698c73
Step 10/10 : ENTRYPOINT ["server"]
 ---> Running in a656d04d13b3
Removing intermediate container a656d04d13b3
 ---> 57e7cb7bbea9
Successfully built 57e7cb7bbea9
Successfully tagged boom:e10786d

-> % docker run -it boom:e10786d                                                                                                            env-2a-second
2019/11/12 00:20:18 Serving from default values, environment variables, and/or flags
INFO[0000] serving gRPC at 0.0.0.0:9090
drewwells commented 5 years ago

This review is on the house 🙂

See you at KubeCon?

I'm skipping this one. Waiting for them to go back to Seattle. I got a great tour of the city ;)