LoginSignup
0
0

More than 1 year has passed since last update.

CodeBuildでビルドする際、jarファイル内にElastic Beanstalk構成ファイル ( .ebextensions ) を差し込む

Last updated at Posted at 2021-06-27

目的

CodeBuildでjarを作成する工程で、Beanstalk構成ファイルである「.ebextensions」ディレクトリをjarの中に差し込みたい。

経緯

プロジェクトでBeanstalkを使用しており、WEBアプリを動作させるために.ebextensionsをjarを差し込む必要がありました。

これまでは7zip等で別途差し込んでいましたが、CodeBuild内で完結出来るようなので試してみました。

修正ポイント

CodeBuildの設定ファイルである「buildspec.yml」を修正します。

今回は、jarファイル作成後にコマンドを実行したいので、buildspec.ymlの「phases/post_build/commands」を修正します。

jarファイルを更新するにはjarコマンドのuオプションを指定して差し込みます。

※.ebextensionsはプロジェクト直下にプッシュしておけばそのまま指定できます。

結果は以下の通り

phases:
  build:
    commands:
      # 任意の設定

  post_build:
    commands:
      - jar -uf sample.jar .ebextensions
      # ↑の1行を追加する
            # ※jarファイル名は適時変更すること

artifacts:
  files:
      # 任意の設定

参考文献

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