-
Notifications
You must be signed in to change notification settings - Fork 671
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
NOISSUE - Add MF_DOCKER_IMAGE_NAME_PREFIX to Makefile #1173
Conversation
Makefile
Outdated
@@ -7,6 +7,7 @@ SERVICES = users things http coap lora influxdb-writer influxdb-reader mongodb-w | |||
bootstrap opcua authn twins mqtt provision | |||
DOCKERS = $(addprefix docker_,$(SERVICES)) | |||
DOCKERS_DEV = $(addprefix docker_dev_,$(SERVICES)) | |||
DOCKER_IMAGE_NAME_PREFIX ?= "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would use mainflux
as prefix here and I would remove it where it's hard-coded.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've thought about it but I'm confused about what to do with /
:
should be /
part of DOCKER_IMAGE_NAME_PREFIX
or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer to keep it outside but let's see what others think about
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@manuio I think mainflux
should be default, and then <docker_registry_url>/mainflux
can be used for other cases.
I preferred previous implementation, looks cleaner and more configurable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@drasko I'm no sure to understand. I proposed DOCKER_IMAGE_NAME_PREFIX ?= "mainflux"
and $(DOCKER_IMAGE_NAME_PREFIX)/$(svc)
to simplify an eventual renaming and because it's hard-coded for many commands.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, cool - then we are on the same page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good, I made MF_DOCKER_IMAGE_NAME_PREFIX ?= mainflux/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We proposed mainflux
, not mainflux/
;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, updated:
MF_DOCKER_IMAGE_NAME_PREFIX ?= mainflux
I do not see a great value of this PR in the core (mostly because of additional code complexity for no big gains). @sprql what is the particular use-case that you have to name images differently? I think that this might be some particular use-case, which can probably be solved with a simple custom script (or even shell one-liner) that renames Mainflux images, but I would like to first hear from you the requirement. |
@drasko It's very handy for custom builds, for example when using different docker registry. I think it's better to introduce MF_DOCKER_IMAGE_NAME_PREFIX env var, so it will be easy to export it in a shell. |
Can you please elaborate on this, because I think that even in the private registries (non-DockerHub) you can have |
@drasko, as I know, to push an image to non-DockerHub registry I should specify host and port in the Docker image name. So to push https://docs.docker.com/engine/reference/commandline/push/ Maybe there is another approach which I don't know… |
I see... I thought that you can give a param to OK, this is good enough reason to add this prefix to the core. Please update the branch and I will do the review. |
Makefile
Outdated
@@ -7,6 +7,7 @@ SERVICES = users things http coap lora influxdb-writer influxdb-reader mongodb-w | |||
bootstrap opcua authn twins mqtt provision | |||
DOCKERS = $(addprefix docker_,$(SERVICES)) | |||
DOCKERS_DEV = $(addprefix docker_dev_,$(SERVICES)) | |||
DOCKER_IMAGE_NAME_PREFIX ?= "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@manuio I think mainflux
should be default, and then <docker_registry_url>/mainflux
can be used for other cases.
I preferred previous implementation, looks cleaner and more configurable.
81be906
to
6651e2c
Compare
Makefile
Outdated
@@ -1,6 +1,7 @@ | |||
# Copyright (c) Mainflux | |||
# SPDX-License-Identifier: Apache-2.0 | |||
|
|||
MF_DOCKER_IMAGE_NAME_PREFIX ?= mainflux/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just mainflux
? I would prefer that service is always prefixed with some name, then followed by /
, so you can have $(MF_DOCKER_IMAGE_NAME_PREFIX)/$(svc)
It is more readable then concatenated like this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought it would be more flexible
6651e2c
to
d5df272
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@sprql update your branch please |
d5df272
to
117c7ea
Compare
@sprql Please, can you update again your branch? We had an issue with the CI... |
Signed-off-by: Alexander Obukhov <[email protected]>
117c7ea
to
87df445
Compare
Codecov Report
@@ Coverage Diff @@
## master #1173 +/- ##
==========================================
+ Coverage 77.23% 77.25% +0.02%
==========================================
Files 102 102
Lines 6816 6816
==========================================
+ Hits 5264 5266 +2
+ Misses 1182 1180 -2
Partials 370 370
Continue to review full report at Codecov.
|
|
||
# Remove unused images | ||
docker images "mainflux\/*" -f dangling=true -q | xargs -r docker rmi | ||
docker images "$(MF_DOCKER_IMAGE_NAME_PREFIX)\/*" -f dangling=true -q | xargs -r docker rmi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are the quotes really needed in "$(MF_DOCKER_IMAGE_NAME_PREFIX)\/*"
or can be removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it depends on that is sh
on your system
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Signed-off-by: Alexander Obukhov <[email protected]>
Allow custom docker image names