Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/make docker image smaller #55

Merged

Conversation

aorfanos
Copy link
Contributor

@aorfanos aorfanos commented Sep 10, 2021

Changes:

  • updated Go version to 1.17
  • used distroless static image

Size reduction ~45% (43.49%) from 28.51MB to 16.11MB.


This change is Reviewable

@coveralls
Copy link

coveralls commented Sep 10, 2021

Pull Request Test Coverage Report for Build 156

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 152: 0.0%
Covered Lines: 408
Relevant Lines: 408

💛 - Coveralls

Copy link
Contributor

@stephen-soltesz stephen-soltesz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello, @aorfanos -- thank you for your contributions! I have a few clarifying questions and small requests.

Reviewable status: 0 of 1 LGTMs obtained


Dockerfile, line 8 at r1 (raw file):

ADD . ./

# TODO(soltesz): Use vgo for dependencies.

If you're making some edits, please remove this TODO. It predates go mod.


Dockerfile, line 12 at r1 (raw file):

-w -s -extldflags '-static'

Can you say why these are necessary now?


Dockerfile, line 15 at r1 (raw file):

    ./cmd/github_receiver

FROM gcr.io/distroless/static

Please add this link as a comment above FROM.

# See also: https://github.com/GoogleContainerTools/distroless/blob/main/base/README.md

I found this to confirm that the TLS certificates were part of this "distroless" image. Initially I briefly confused with this and FROM scratch.

@aorfanos
Copy link
Contributor Author

hey @stephen-soltesz , happy to contribute to such an amazing project :)

Regarding this:

-w -s -extldflags '-static'

The flags -w -s are used to decrease image size by not including debugging information and the symbol table on the created executable.
Flag extldflags static use was to create a static binary including libraries at build time, but after checking it does not contribute to the executable size reduction I have removed it.

Copy link
Contributor

@stephen-soltesz stephen-soltesz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

:lgtm:

Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: :shipit: complete! 1 of 1 LGTMs obtained

@stephen-soltesz stephen-soltesz merged commit 58f2ab9 into m-lab:master Sep 23, 2021
@aorfanos aorfanos deleted the feature/make-docker-image-smaller branch September 24, 2021 02:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants