What is the workflow for updating a rails app in AWS EC2 via Docker with docker-machine?

主宰稳场 提交于 2020-07-09 19:34:42

问题


I'm new to Docker, and am trying to understand the workflow for updating my app in AWS, after it's live. For now, the rails app and MySQL database are both on the same EC2 instance. Here's what I'm doing to get the app live:

I have a dockerfile a docker-compose.yml file that define the services. The rails application source is linked to the app container with a bind mount in docker-compose.yml:

  app:
    ...
    volumes:
      - $PWD:/zhxword

When I'm ready to deploy, I run:

docker-machine create --driver amazonec2 --amazonec2-instance-type "t2.micro" production
docker-machine env production
eval $(docker-machine env production)

From this point on, my docker-compose commands target the production container (EC2):

docker-compose build
docker-compose up -d

The docker-compose build command took a really long time, but eventually it finished, and the app started, and I could access it over HTTP.

My question is about the process for making changes. For example, a change to docker-compose.yml (such as exposing port 443) or routine changes to the rails code. If I run docker-compose down && docker-compose up that doesn't seem to be enough - changes to docker-compose.yml don't seem to be reflected. I assume running docker-compose build is going to work, but that re-provisions the whole server, and takes an excruciatingly long time.

What are the practical steps for routine updates once the dockerized app is live? Is there a quick way of forcing it to refresh code?

来源:https://stackoverflow.com/questions/62240806/what-is-the-workflow-for-updating-a-rails-app-in-aws-ec2-via-docker-with-docker

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!