marnen / contraq

Contract tracker for musicians and other freelancers
MIT License
0 stars 2 forks source link

Create a Docker container build for development #33

Closed marnen closed 6 years ago

marnen commented 6 years ago

In order to deploy to Google Cloud (if we go that route) and generally make setup easier, we should containerize the application.

marnen commented 6 years ago

This will also make Travis builds not have to install so much stuff, I think.

marnen commented 6 years ago

Google Cloud Engine docs for Docker: https://cloud.google.com/compute/docs/containers/deploying-containers. I have no particular love (or hate) for Google Cloud; I just think that their free tier (with Docker) is most suitable for our needs.

marnen commented 6 years ago

I think I will try Alpine Linux as container OS first, and fall back to Ubuntu if that doesn't work.

marnen commented 6 years ago

Possibly helpful: https://blog.codeship.com/build-minimal-docker-container-ruby-apps/

marnen commented 6 years ago

Actually, for now, in the interests of quick development and decent base image, I think I'll use https://github.com/phusion/passenger-docker for deployment. We can always change this later.

marnen commented 6 years ago

...or not. Puma is multithreaded and may be a better choice than Passenger now. Looking at https://erudinsky.com/2017/05/15/how-to-run-rails-app-with-postgres-puma-and-nginx-in-docker for more ideas.

marnen commented 6 years ago

That tutorial looks pretty good, actually. I'll probably largely follow it.

marnen commented 6 years ago

I'm going to reduce the scope of this story. For right now, we'll just produce a Docker container for development and Travis, and I'll move the production Docker container to a separate story (multistage builds may be helpful).

marnen commented 6 years ago

We now have master being automatically built on Docker Hub.

marnen commented 6 years ago

Rats. I can't get Travis to use cache_from correctly in the compose file. See https://github.com/docker/docker-py/issues/998 and https://github.com/docker/docker-py/pull/1582 for possible reasons.

marnen commented 6 years ago

I think I may have been wrong about cache_from. It looks like I had set the environment variables improperly so that the compose file I wanted wasn't being picked up.