Closed zscole closed 6 years ago
Thanks! I was experimenting with methods to create a smaller image size so I could reduce the storage footprint and run more containers. Couldn’t get it any smaller than ~22mb, I think. Meant to only leave the base layer rather than multistaging it. Worth a shot at least!
On Aug 30, 2018, at 8:35 PM, Chih Cheng Liang notifications@github.com wrote:
@ChihChengLiang commented on this pull request.
Great work. Added some comments on simplifying the dockerfile . (btw, like the cute animal dog 😍)
In docker/prod.Dockerfile:
@@ -9,6 +9,6 @@ RUN go get -d -v . RUN make deps RUN CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -v -o main .
-FROM base +FROM iron/go:dev can remove the line 1~2 if the base image specified there is unused
In test/Dockerfile:
+RUN go get -d github.com/ethresearch/sharding-p2p-poc/...
- go get ./... &&\
- make deps &&\
- go build
+COPY .sharding-p2p-poc .
+RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o sharding-p2p-poc .
+FROM iron/go:dev
+RUN apk --no-cache add ca-certificates
+WORKDIR /root/
+COPY --from=0 /go/src/github.com/ethresearch/sharding-p2p-poc/ . It looks like 1-stage build is already awesome in this use case. The main purpose to use 2-stage build is to put source code in one fat image for a disposable build environment and the binary built in another thin image for execution environment.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
I have made the changes requested. I'll be pushing some more changes here shortly to reflect the results of our preliminary tests.
changed main.go to accept rpcaddr as a flag arg. need to set to 0.0 or bind to other interfaces for testing purposes. defaults to loopback unless otherwise expressed.
CI failed again but with a different reason: docker: Error response from daemon: oci runtime error: container_linux.go:265: starting container process caused "exec: \"/main\": stat /main: no such file or directory"
.
Is this latest branch good or do I need to make any changes? About to start some tests.
Ok, I fixed the Dockerfile in the test dir. Happy to say I cut it down from >200mb to 27.2MB and it seems to work well. I had trouble with the original Dockerfile in the master repo, so this was the product of my rewriting it. Let me know what you guys think!
I specified exposed ports in the Dockerfile, but I think we're going to encounter some issues in relation to the UDP write process. Since it's assigned an ephemeral port (1024-65535) at run time, it's not a deterministic value, meaning we can't account for that in our code. If we could hard code this value, at least for the purposes of testing, it would be a lot easier. I may be misunderstanding, so please correct me if I'm wrong.
What was wrong?
Created a dir for our test results. Some people on my team had trouble installing properly, so I tried to rewrite the README to be a bit more detailed.
How was it fixed?
Cute Animal Picture