-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Dockerfile: go mod cache #3142
Dockerfile: go mod cache #3142
Conversation
Welcome @7sunarni! |
assign @Thor-wl |
Hi~ Can you take minutes review this, it could speed up CI stage |
please make the DCO CI happy first |
Done |
/lgtm |
It seems both of reviewers not active any more, how about assign new reviewer? |
Update: this commit use alpine mirror to speed up building webhook-manager docker image. I think most of Volcano's user in mainland. This mirror could be useful in improving building container image. |
@Monokaix Hi~ Sorry to tag you. It looks like that two reviewers assigned not active in this project. Do you know how and who to assign new reviewers? |
It's a good intention here. But volcano is used all over the world, we should not specify cdn url in a hard code way, my opinion is that set a parameter like env to let user specify custom cdn url or just disable it: ) |
Welcome! A little doubt here. Does this cache optimization you mentioned only take effect when building multiple binaries? Seems that when we execute |
I think when your change not including go.mod and go.sum file and just including some go file, in docker building stage, this will not download dependency. Not only in building multiple binaries, and in local develop/test stage building image.
As I know, docker will use the cache if the file don't change. In most case, |
ADD . volcano | ||
RUN cd volcano && make vc-webhook-manager | ||
|
||
FROM alpine:latest | ||
ARG KUBE_VERSION="1.27.0" | ||
ARG TARGETARCH | ||
RUN apk add --update ca-certificates && \ | ||
ARG APK_MIRROR | ||
RUN if [[ -n "$APK_MIRROR" ]]; then sed -i "s@https://dl-cdn.alpinelinux.org@${APK_MIRROR}@g" /etc/apk/repositories ; fi && \ |
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 we should also add --build-args includes this env in docker build command: )
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.
You are right.
Got that! And please rebase and make a clean pr. |
You are right. I add a argument like By the way, it seems you are from Huawei. And the usage in this official article seems have a little mistake. The config command should be |
Thanks, I will convey the mistake but I'm not responsible for that article actually: ) |
You can also make suggestions in the forum https://bbs.huaweicloud.com/suggestion/new directly. |
Done |
Is "--build-arg APK_MIRROR="https://mirrors.huaweicloud.com" updated? I didn't see that yet: ) |
retrigger the ci. |
I don't add this parameter in Makefile. If this parameter is missing, it will not change the alpine mirror. |
Can the env transfer to docker image context?Seems that the env should be transferred through build-arg. |
…t allow using alpine mirror Signed-off-by: 7sunarni <710720732@qq.com>
It can. I add parameter to the Makefile. |
/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.
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: william-wang The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
cache go modules, so improve building speed
https://docs.docker.com/language/golang/build-images/#create-a-dockerfile-for-the-application