sean0x42 / markdown-extract

Extract sections of a markdown file. Useful for automatically extracting changelogs
https://hub.docker.com/r/sean0x42/markdown-extract
MIT License
31 stars 7 forks source link

Create Docker image #6

Closed sean0x42 closed 4 years ago

sean0x42 commented 4 years ago

This pull request allows users to pull a docker image of markdown-extract.

The docker image has been uploaded to hub.docker.com, and should now automatically rebuild whenever code is pushed to master.

https://hub.docker.com/r/sean0x42/markdown-extract

Closes #2.

sean0x42 commented 4 years ago

@brennerm could you please view the changes introduced to README.md regarding Docker? This is my first time publishing a docker image, so if if anything smells please let me know.

brennerm commented 4 years ago

Two comments regarding the Dockerfile:

  1. Think about using a multistage Dockerfile. First stage would be to build the markdown-extract binary and the in the second stage you copy it over to something like an alpine or busybox image. This would decrease the image size by a significant amount. Reference: https://docs.docker.com/develop/develop-images/multistage-build/#use-multi-stage-builds

  2. Set the ENTRYPOINT to the markdown-extract binary and leave the CMD empty. This allows for easy use of your Docker image. You can take this Dockerfile as an example: https://hub.docker.com/r/hashicorp/terraform/dockerfile

sean0x42 commented 4 years ago

Thanks for the ideas. I've got to spend some time on other things, but I will address these points soon hopefully

sean0x42 commented 4 years ago

Wow @brennerm, it's crazy how the multi-stage build reduces file size... I've managed to get it down to just 70mb. I did some experimentation and I think I could get it even lower with alpine as you suggested, but presently I run into some compilation errors so I think I'll leave that problem for another day.

Edit: Just opened a new ticket to track this #7

brennerm commented 4 years ago

Thanks for your short-term improvements. Will now happily use markdown-extract in my CI pipeline. :+1: