1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【Postgresql & Docker】M1 Mac Apple 製のCPUに対応する開発環境への対応

Last updated at Posted at 2022-04-06

AppleのM1チップに変更後開発環境が動かなくなった

具体的には Postgresql のイメージが対応していなかった。
バージョンは9.3.16を利用していましたが、13でも問題なく開発することができたのでそちらへ変更

ベストな対応方法はいろいろあるが一応動いたので、google検索で引っかかるように記事化。

docker-compose.ymlの記載を以下のように変更した。

before
image: postgres:9.3.16
after
platform: linux/x86_64
image: postgres:13

postgresql の docker image 一覧はこちらから

linux/x86_64の記載は必要か

platform: linux/x86_64 と記載することで、M1チップ対応することができるという記事も散見されたが
postgres13の場合は特にこの記載がなくとも動作することが確認できた

新機能もいくらか増えているが本番環境では12あたりを利用しているので差分に気をつけたい。
もちろん同じバージョンにしていくこと前提なので、本番を13に上げたいですね:eyes:

postgresql13の公式リリース
https://www.postgresql.org/about/news/postgresql-13-released-2077/

therubyracer も非対応になっていた

therubyracer、v8、いつもトラブルになる子ですね。
こちらも開発環境では不要で、jsのコンパイルに必要なだけなので開発環境では without する対応に一旦してます

最新の ruby にアップデートすれば miniracer が入っているのですが
現状のアプリをすぐにアップデートできないので一旦このような対応をお茶を濁してます

bundle install --without apple_slicon
Gemfile
group :apple_slicon do
  gem 'therubyracer', '0.12.3', platforms: :ruby
end
1
1
1

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?