DEV Community

loading...
Cover image for Dockerfile Templates For All Programming languages

Dockerfile Templates For All Programming languages

Gautham Prakash
I'm a tech enthusiast who would love to help others and learn more through that process.
・1 min read

Docker templates for most common programming languages.

Project Link: ttps://github.com/gauthamp10/dockerfile-boilerplates

Feel free to contribute.https://github.com/gauthamp10/dockerfile-boilerplates/blob/master/CONTRIBUTING.md

Discussion (10)

Collapse
habereder profile image
Raphael Habereder • Edited

I glanced over a few of them, and If there was one thing I'd recommend, it's always using

USER nobody

In case someone doesn't have User Namespace Remapping active, it would also run as nobody and your System won't be compromised as easily.

If you want I can take a longer look later and recommend some Basic hardening in an issue, or create some pull requests for you.

Other than that, thanks for doing this :)

Collapse
gauthamp10 profile image
Gautham Prakash Author • Edited

I was patching up the same . Will do ASAP.
Now I'm adding a user to group to do things other than package downloading.
It would be helpful if you could guide me when you have the time @habereder
Thanks by the way.

Collapse
habereder profile image
Raphael Habereder

Gladly!
I just forked it and will implement some basic things in different branches for you to cherry-pick then :)

Thread Thread
gauthamp10 profile image
Gautham Prakash Author

Cool.

Collapse
bovermyer profile image
Ben Overmyer

I looked over the Go and PHP images. There's no benefit to using either one - they just wrap existing tool images and add metadata that will vary greatly between developers.

When I see a Dockerfile template for Go, I want to see a multistage build toolchain that produces a very slim binary inside a Docker image.

When I see a Dockerfile template for PHP, there are far too many possible ways to build a Docker image for such an app, so I'd err on the side of making several boilerplate images - one for a straight Composer build, one for a Laravel build, and one for a Symfony build. All of them would have to be multistage.

Collapse
gauthamp10 profile image
Gautham Prakash Author

The project was built for just to be able to run source directly and not for production purpose in the beginning. But now more people are asking for multistage build which are useful as mentioned for real world development. I didn't expect such an overwhelming response for such a project. So now I will try to add useful multistage builds ASAP. For now, if interested anyone could open a pull request and add one.

Thank you for your feedback.

Collapse
sloan profile image
Sloan

Hi there, this post might fit better as a DEV Listing. It’s a dedicated area of the platform where community members and organizations are encouraged to publish information related to events, products, services, job listings, and everything in between.

Collapse
gauthamp10 profile image
Gautham Prakash Author

Oh... I was new to the community. And I didn't knew. Thanks by the way.

Collapse
terkwood profile image
Felix Terkhorn

Nicely done! I jumped straight to my favorite and found an alpine build, which has been on my list of things to explore (the standard, non-alpine rust build uses a lot of disk). This moves me forward! Thanks a bunch.

Collapse
gauthamp10 profile image
Gautham Prakash Author

Appreciate it. Do note that these image are not production ready yet.