Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dynamically change dockerrun.aws.json image tag on deploy

Is there a way to dynamically get the version tag from my __init__.py file and append it to the dockerrun.aws.json image name for example::

{
  "AWSEBDockerrunVersion": "1",
  "Authentication": {
    "Bucket": "dockerkey",
    "Key": "mydockercfg"
  },
  "Image": {
    "Name": "comp/app:{{version}}",
    "Update": "true"
  },
  "Ports": [
    {
      "ContainerPort": "80"
    }
  ]
}

This when when I do eb deploy it will build the correct version. At the moment I have to keep modifying the json file with each deploy.

like image 754
Prometheus Avatar asked Dec 09 '15 11:12

Prometheus


2 Answers

I also stumbled upon that last year, where AWS support stated there's no such feature at hand. I ended up writing a script that receives the docker tag as parameter and composes the dockerrun.aws.json file on the fly with the correct tagname.

like image 104
Tal Avatar answered Nov 07 '22 10:11

Tal


I've written a bash script which runs

eb deploy

Before it executes that command I change a symlink depending on if I'm running production or staging. For Example:

ln -sf ../ebs/Dockerrun.aws.$deploy_type.json ../ebs/Dockerrun.aws.json

like image 41
Morgz Avatar answered Nov 07 '22 10:11

Morgz