-
-
Notifications
You must be signed in to change notification settings - Fork 912
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expand 'goos' and 'goarch' combinations in 'dockers'. #707
Comments
setting each image explicitly will work, but we should indeed fix those issues. Thanks for opening this issue! |
#716 will fix this two items:
the other one will be fixed in another PR |
I was thinking, I'm not sure this is a good idea. For example, most arm-based images will have another base image -> https://github.com/docker-library/official-images#architectures-other-than-amd64 So, maybe it will end up making all things overcomplicated... For builds, it is easy enough to guess which goos/goarch/goarm combos are valid or not, for docker I think it may not be that easy. Maybe I'm missing something here, but it seems to be that a little repetition may be better in this case... Thoughts?
|
I think that expansion is mostly useful for applications distributed in scratch images, where you don't need to worry about the host system. In other contexts, it'd be great to support partially sharing the params. For example: dockers:
- goarch: amd64
from: debian:buster-slim
- goarch: arm64
goarm: 8
from: arm64v8/debian:buster-slim
- goarch: arm
goarm: 6
from: arm32v6/alpine
goos: linux
image: "{{ .ProjectName }}/{{ .ProjectName }}"
skip_push: true
tag_templates:
- "{{ .Arch }}{{if .Arm}}v{{.Arm}}{{end}}-{{ .Tag }}"
- "{{ .Arch }}{{if .Arm}}v{{.Arm}}{{end}}-latest"
extra_files:
- Docker.json |
this second proposal seems to make more sense... you could use yaml variables though... |
That makes sense. I had not thought about yaml variables! However, in order to support using the same Dockerfile, adding a dockers:
- &docker
goarch: amd64
from: debian:buster-slim
goos: linux
image: "{{ .ProjectName }}/{{ .ProjectName }}"
skip_push: true
tag_templates:
- "{{ .Arch }}{{if .Arm}}v{{.Arm}}{{end}}-{{ .Tag }}"
- "{{ .Arch }}{{if .Arm}}v{{.Arm}}{{end}}-latest"
extra_files:
- Docker.json
- <<: *docker
goarch: arm64
goarm: 8
from: arm64v8/debian:buster-slim
- <<: *docker
goarch: arm
goarm: 6
from: arm32v6/alpine |
this would mean templating the Dockerfile as well - which also means you won't be able to manually build from that Dockerfile anymore. I think repeating a bit of code here makes things easier to understand and to maintain later... |
What about using |
I rather leave things the way it is for now. This little repetition won't hurt and support all scenarios already. The template enhancements were valid though, and they are implemented. That being said, I'll close this for now. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
I am trying to reproduce the compact syntax of the 'build' field in order to generate multiple docker images, each one corresponding to a built binary, and all of them based on the same Dockerfile and sharing the same image name.
Given then following configuration file, I'd like multiple docker images to be created, each of them with two tags.
The problems I find are:
goarch
andgoarm
indockers
must have a single value.{{ .ProjectName }}
cannot be used to set the dockersimage
.{{ .Arch }}
nor{{ .Arm }}
can be used to settag_templates
.I've considered setting each image explicitly:
As additional context, this is the Dockerfile:
The text was updated successfully, but these errors were encountered: