-
Notifications
You must be signed in to change notification settings - Fork 124
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
Add Dockerfile #80
Add Dockerfile #80
Conversation
Dockerfile
Outdated
RUN go mod download | ||
|
||
COPY . . | ||
RUN go build -a -o pluto *.go |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are more flags necessary here to make it build like the normal binary. In particular, you'll want -s and -w, as well as passing the version and commit as build args.
Line 12 in 81c8d32
$(GOBUILD) -o $(BINARY_NAME) -ldflags "-X main.version=$(VERSION) -X main.commit=$(COMMIT) -s -w" -v |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another example in Goldilocks:
https://github.com/FairwindsOps/goldilocks/blob/master/Dockerfile
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh nice, didn't see the make file. I'm just running make build-linux
now. Do I need to pass in VERSION
etc?
Also looks like there's a build-docker
already, seems to be working
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you'll need to add the ARG directive to the dockerfile so that it gets picked up on build to make the build-docker work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh cool, I'd never seen ARG
before. Did I do it right?
Codecov Report
@@ Coverage Diff @@
## master #80 +/- ##
=======================================
Coverage 78.49% 78.49%
=======================================
Files 6 6
Lines 372 372
=======================================
Hits 292 292
Misses 53 53
Partials 27 27 Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like you'll need the build-arg:
└─ docker run quay.io/fairwinds/pluto:build_377 /pluto version
Version:local-dev Commit:e020c9b98796232c37daedae0a6879d7775c13ad
Also, you may want to add an entrypoint or a command so that the dockerfile just runs the binary by default.
Edit: Actually, not sure about the build arg. Forgot I wasn't building a tag.
No description provided.