Search code examples
playframeworksbtdockeramazon-elastic-beanstalksbt-native-packager

sbt-native-packager with Docker and Elastic Beanstalk congifuation


I'm using sbt-native-packager to deploy my Playframework app to Elastic Beanstalk as a Docker container. It's all working pretty well, but I need to customize the ELB instance a bit. Amazon documents here that you do this by creating a .config file "in an .ebextensions top-level directory of your source bundle."

Seems simple enough, but I'm not sure what the best way to get sbt-native-packager to pick up my .ebextensions directory and put it in the right place. I know if I was creating the bundle using the command docker build -t my-docker-app /my-project-root I would stick the directory right under my-project-root, but I am confused by how things are bundled with native packager.

Thanks in advance!


Solution

  • The Docker Plugin uses the Universal Plugin under the hood. So you can use the default folder structure to simply add directories/files to your app.

    src/universal/.ebextensions
    

    This will result in an ouput directory structure like this

    .ebextensions/
    bin/
    lib/
    conf/
    

    If this it not enough for you, you can always customize the mappings in Docker or mappings in Universal as described here