0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

sbt-native-packagerでmulti-platform対応のdockerイメージを作る

Posted at

結論

build.sbtに以下のように記述すればいける。

dockerBuildxPlatforms := Seq("linux/amd64", "linux/arm64/v8")

詳しい話

Dockerは後付けで複数のCPUアーキテクチャに対応した歴史があり、sbt-native-packagerを使った場合でも、公式ドキュメントには書いてないが上記のような設定キーがあり、動かせる。

ただdockerのmulti-platform対応そのものがまあまあ面倒くさく、各々の環境で以下のコマンドが最低でも動くようにしておく必要がある。

docker buildx build --platform linux/amd64,linux/arm64/v8 .

自分のLinux環境だと、QEMUをインストールの上でbuildxのdocker-containerドライバを生成する必要があった。

もちろんdockerBaseImageに使うイメージが使いたいplatformに対応している必要もある。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?