Skip to content
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

chore: refactoring docker system #81

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

albttx
Copy link
Contributor

@albttx albttx commented Feb 10, 2025

No description provided.

Dockerfile Outdated
@@ -1,20 +1,22 @@
ARG IMG_TAG=latest
ARG GO_VERSION="1.22.10"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not have a default value here. I assume without it the gh action will fail because it currently relies on it, but this is not what we want. We want the GO_VERSION to match the version declared in the go.mod, like in make docker-build-debug.

Probably the simplest way to handle this is to call make docker-build-debug in the gh action (or maybe use an alias make docker-build).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mhhh, i don't like not having value here, because a simple docker build -t my-img . would fail

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or we can move the -alpine in the makefile, and have by default alpine which will take the latest go version ?

Copy link
Collaborator

@tbruyelle tbruyelle Feb 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mhhh, i don't like not having value here, because a simple docker build -t my-img . would fail

Yes, and it's not a problem per say.

The problem here is if we upgrade the go version in the go.mod, the docker build will fail because the make install command will return an error because the go versions (docker image and go.mod) does not match.

In other words, if we upgrade the go version in the go.mod, we also have to change this ARG here, and this is what I want to avoid.

Maybe it is possible to guess the go version in a preliminary stage of the docker file, where go list -f {{.GoVersion}} -m is executed just like in the Makefile. If yes then we don't need that ARG. But I'm not sure it is possible to define ARG with executed content inside the docker file.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or we can move the -alpine in the makefile, and have by default alpine which will take the latest go version ?

But the go version of the docker build must match the go of the go.mod, like the restriction we have in the makefile. I don't understand why do you want to ignore the restrictions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, i've updated this way :)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, but I think the gh action needs to be updated accordingly. The step docker/build-push-action@v5 will not feed the GO_VERSION arg I suppose. Is there a way to test this gh action?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants