Skip to content
This repository has been archived by the owner on Nov 5, 2019. It is now read-only.

Reworked Dockerfile for flexibility #22

Merged
merged 1 commit into from
Oct 27, 2017
Merged

Reworked Dockerfile for flexibility #22

merged 1 commit into from
Oct 27, 2017

Conversation

ibnesayeed
Copy link
Contributor

@ibnesayeed ibnesayeed commented Oct 26, 2017

This reworked Dockerfile is intended to keep the current behavior unchanged while bringing a lot of additional advantages. It has also fixed some issues that were present erlier.

  • By default it builds a minimal final images for production without any development/build time bloat.
  • Allows building a development-friendly image using --target=dev flag at build time. This will have gin setup in place which can make it a fun experiences if the code is mounted at the appropriate place form the host machine.
  • Allows custom build with specific Golang and Alpine Linux versions for quick testing, if necessary, using GOLANG_TAG and ALPINE_TAG build args (both default to latest).
  • Tests the code before building the binary.

@patcon patcon requested a review from b5 October 27, 2017 00:27
@patcon
Copy link
Member

patcon commented Oct 27, 2017

ah cool! i was actually stepping on your toes today, as i was working on dev docs and noticed some really low-hanging issues with the dockerfile -- any chance you might be able to give it a quick look-over? :)
https://github.com/datatogether/coverage/pull/23/files

our convo in slack was that gin wasn't necessary, but curious your thoughts on that -- if you have experience with it being very helpful, maybe we could link to a good setup resource on why/how people can use it?

@ibnesayeed
Copy link
Contributor Author

ibnesayeed commented Oct 27, 2017

I have seen #23 already. You can either revert 32863ce in your PR or resolve the conflict later when merging this one.

As far as gin is concerned, this Dockerfile will not include that in the final build for production (in fact the final build has nothing but the ca-certs and the static coverage binary in the very minimal Alpine Linux). However, in the development mode it will be present and run by default, but the command can be overwritten to run the coverage binary instead. I have never used gin, but it was commented in the Dockerfile, so I looked at its documentation and realized that it can be helpful as it allows hot-reloading. That's why I added it in a way that it can be used optionally.

Corresponding documentation can be updated once these things are in place. I did not add anything in the docs yet because I though someone might be working on that, so it would cause unnecessary conflict.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants