Building multi-architecture docker images with Skaffold

家住魔仙堡 提交于 2021-01-29 17:12:11

问题


I've been able to get two awesome technologies to work independently.

  • Skaffold
  • BuildX

Unfortunatly I don't know how to use them both at the same time.

I'm currently building and testing on my laptop (amd), then deploying to a Raspberri Pi 4 (arm64) running Kubernetes.

To get this working I use something like:

docker buildx build --platform linux/amd64,linux/arm64 --tag my-registry/my-image:latest   --push  .

Before attempting to target an arm I was using skaffold.

Is there any way to continue to target multi-playform whilst also using skaffold to build/deploy? If not, is there any recommendations for alternatives?

Any advice/help is very appreciated, thank-you.


回答1:


Found the missing piece. Skaffold has the ability to set a custom command, where I could use buildx.

https://github.com/GoogleContainerTools/skaffold/tree/master/examples/custom

build:
  artifacts:
  - image: "foo/bar"
    context: .
    custom:
      buildCommand: ./custom-build.sh

custom-build.sh

docker buildx build \
  --platform linux/arm64 \
  --tag $IMAGE \
  --push \
  $BUILD_CONTEXT



回答2:


I think you need to install a driver in order to use both.

https://medium.com/nttlabs/buildx-kubernetes-ad0fe59b0c64

Edit here is an implementation example with a GO qiita.com/J_Shell/items/beb266ef65270217a9ed (please use the translator)



来源:https://stackoverflow.com/questions/60067799/building-multi-architecture-docker-images-with-skaffold

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!