4 ms·
this was my first attempt dockerfile. thank you for your interest :)
by indatawetrust 11y ago
this was my first attempt dockerfile. thank you for your interest :)
- extrapickles 11y agoLooks good for a first dockerfile. You may want to try combining several of the run commands together to save on the number of layers generated and improve the final size. A good rule of thumb is to combine if the command can touch the files of a previous command. Then it becomes easy to clean up after downloading a package (no need to have the downloaded version and the installed).
- manojlds 11y agoUse phusion base image as a guide for best practices around RUN steps and cleanup.
- bgentry 11y agoNice first pass! I haven't looked at the final image size, but I suspect that starting with ubuntu:latest means that you'll have a pretty large resulting image with a bunch of unnecessary software installed. For your next attempt, you might want to look into creating a more slim image that contains only the required dependencies. I guess an alternate version of this would be one which has the core Phoenix dependencies but none of the asset management / Node.js stuff. I have a Phoenix API w/ no assets that could use such an image :)
- zenlikethat 11y agoEven just switching Ubuntu out for Debian can shave off ~50MB and rarely requires additional modfications IME (unless using something Ubuntu specific).
- BlackjackCF 11y agoAgreed with the statements about combining your run layers. The fewer layers you have the better. Also, I would try to build this using Alpine or another smaller Linux distro.