惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

美团技术团队
Microsoft Azure Blog
Microsoft Azure Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
B
Blog
Y
Y Combinator Blog
博客园_首页
有赞技术团队
有赞技术团队
博客园 - Franky
腾讯CDC
G
Google Developers Blog
Recent Announcements
Recent Announcements
博客园 - 【当耐特】
D
Docker
The GitHub Blog
The GitHub Blog
MyScale Blog
MyScale Blog
H
Help Net Security
Apple Machine Learning Research
Apple Machine Learning Research
A
About on SuperTechFans
D
DataBreaches.Net
T
The Blog of Author Tim Ferriss
V
V2EX
U
Unit 42
aimingoo的专栏
aimingoo的专栏
WordPress大学
WordPress大学

Hunsh's Blog

生成个人的 Github PR List 如何选择合适的加密手段 Nginx SNI Proxy 如何优雅导入 k8s.io/kubernetes Make Go mod and Git to use specify .netrc 多架构镜像的体积优化 如何修改镜像 layer(以 sourcemap-less grafana 为例) acme.sh 自动化 Google CA 申请证书 微信小程序嵌入任意公众号文章 k8s && bazel 项目从 go1.20 升级 go1.21 go serve http and https on same port typecho 迁移到 hexo 实现 hexo 文章和资源在同一目录下 golang mitm 遇到的问题 流式数据专用的 mine-type Golang 正向代理对于 Host 的处理 (RFC 7230) 分享 MacOS 的一些系统fix脚本(dns、sleep) prometheus rate/increase/delta/sum等函数不符合预期或出现小数的原理 [油猴脚本] USTB Everywhere 为校外访问添加访问任意网站的能力
使用 buildkit 进行多架构构建并提取产物
2024-04-13 · via Hunsh's Blog

其实是在 static-openssh 使用的,抽出来记录一下。

使用 Dockerfile 进行构建主要有两个好处:

  1. 可复现
  2. 可利用 buildkit 实现多架构构建

在 Dockerfile 部分,我们需要使用多阶段构建,将 builder 的产物 copy 到一个 scratch 的产物容器中

1
2
3
4
5
6
7
8
# Dockerfile
FROM ubuntu:22.04 as builder
# RUN command here
RUN echo mock > output

FROM scratch

COPY --from=builder /output /

然后指定需要的 platform,然后让这个容器内容输出到本地以拿到构建产物

1
docker buildx build --platform linux/arm64,linux/amd64 -o "type=local,dest=dist" -f Dockerfile .

此时产物就在 dist 目录下了