1
1

More than 3 years have passed since last update.

M1 macとインテルMac+others で Dockerfileを扱う方法

Posted at

M1 macとインテルMac、Windows環境が混在した場合に、Dockerが上手く使えなかったので、なんとか作ってみました。重要なのは、コンパイル部分を一つにまとめる事です。

以下の記事を参考にさせていただきました。

ソース

RUN if [ $(uname -m) = "aarch64" ]; then \
  echo arm64; \ 
  # M1 Mac用
  # インストールしたいパッケージのコマンドが入る
  && ./configure --build=arm \
  && make \
  && make install; \
  else \ 
  echo amd64; \
  # それ以外のOS用
  # インストールしたいパッケージのコマンドが入る
  && ./configure \
  && make \
  && make install; fi

これで、今まで課題でGitで管理するのがめんどだった部分が無事解決しました。
M1 macはuname -mでaarch64という環境情報をはいてくれるのでこれを使います。

1
1
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
1
1