

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 在 Elastic Beanstalk 上使用 Gemfile 安裝套件
<a name="ruby-platform-gemfile"></a>

若要使用 RubyGems 安裝應用程式所需的套件，請在專案來源的根目錄中包含 `Gemfile` 檔案。

**Example Gemfile**  

```
source "https://rubygems.org"
gem 'sinatra'
gem 'json'
gem 'rack-parser'
```

如 `Gemfile` 檔案存在，Elastic Beanstalk 會執行 `bundle install` 來安裝相依性。如需詳細資訊，請參閱 Bundler.io 網站上的 [Gemfiles](https://bundler.io/man/gemfile.5.html) 和 [Bundle](https://bundler.io/man/bundle.1.html) 頁面。

**注意**  
除了預先安裝在 Ruby 平台上的預設版本外，您還可以使用 Puma 的其他版本。若要這麼做，請在 `Gemfile` 的項目中指定版本。您也可以使用自訂 `Gemfile` 來指定不同的應用程式伺服器，例如 Passenger。  
對於這兩種情況，您還需要設定 `Procfile` 以啟動應用程式伺服器。  
如需更多詳細資訊，請參閱*[使用 Procfile 設定應用程式程序](https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/ruby-platform-procfile.html)**。*