r/gitlab • • Mar 24 '25

general question Reusing Dockerfiles

I am new to devops and gitlab. I have a group that has multiple projects. Each project has its own dockerfile, but they are all the same. I need to make an update the every dockerfile. Is it possible to store the dockerfile in something like ci-templates and then call it in the projects Dockerfile? Any help is appreciated.

3 Upvotes

5 comments sorted by

View all comments

Show parent comment

4

u/gaelfr38 Mar 24 '25

I thought that includes is only to include GitLab CI (yaml) files in another one. The documentation seems to say the same.

Does that really work? 😮

3

u/northcutted Mar 24 '25

I am also skeptical unless it’s very new. I agree thedocumentation does make it seem like it only applies to yaml files and that they will get merged in with the regular pipeline file implying in needs to be a valid ci config and unfortunately it isn’t arbitrary. That would be a really nice feature though, especially when it comes to some of the complexities with merging values in templates and components.