This is what worked for me ...
Dockerfile
In this example, I use phusion/passenger-ruby22:0.9.16 as the base image, because:
- Your Dockerfile may be smaller.
- This reduces the time it takes to write the correct Docker file. You do not have to worry about the base system and the stack, you can only focus on your application.
- Correctly installs the base system . It is very easy to get the base system wrong, but this image does it right. More details ...
- This significantly reduces the time required to launch
docker build , which allows you to restart the Docker file faster and faster. - This reduces load times during redistribution. Docker only needs to download the base image: during the first deployment. Each subsequent deployment only loads the changes that you make over the base image.
You can find out more about this here ... anyway, on the Dockerfile .
Dockerrun.aws.json
{ "AWSEBDockerrunVersion": "1", "Ports": [ { "ContainerPort": "80" } ], "Logging": "/home/app/myapp/log" }
.dockerignore
/.bundle /.DS_Store /.ebextensions /.elasticbeanstalk /.env /.git /.yardoc /log/* /tmp !/log/.keep
Nginx-env.conf
Note that rails-env.conf does not set any environment variables outside of Nginx, so you won’t be able to see them in the shell (i.e. Dockerfile ). You will also have to use different methods to set environment variables for the shell.
# By default Nginx clears all environment variables (except TZ) for its child
nginx.conf
server { listen 80; server_name _; root /home/app/myapp/public;
source share