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

More than 5 years have passed since last update.

HerokuにDockerFileのイメージを使用してリリースする

Posted at

はじめに

※学んだことアウトプット用です。
複数コンテナリリースや、DBとの連携までは書いていないです。

メリット

dockerで開発することで環境依存問題を解決できる。
リリースもコンテナをプッシュするだけで簡単にできる。

実際にリリースしてみよう

事前にherokuにログイン

heroku container:login

DockerFileのあるディレクトリで

heroku container:push web

イメージがビルドされて、プッシュされる。

そのあと

Heroku container:release web

これでプッシュされたイメージが起動する

補足

Railsの場合はserver.pidがコンテナに取り込まれるとHeroku上で起動できなくなる

いちいちプッシュする際にサーバーを落とすのは面倒なので、対策を打つ。
対策として、.dockerignoreにserver.pidを登録することで、イメージに含まれなくなる
イメージに含まれなくなると無事にコンテナを起動することができる

.dockerignore
pids/server.pid
1
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
1
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?