Live data from Hacker News

Developing with Docker at IFTTT

medium.com

11–20 of 29 posts

Re: Developing with Docker at IFTTT

#11

Earlier quoted context omitted.

Thanks! We experienced that exact same pain. Whether it's pip or Bundler, I can't tell you how many times I've installed and reinstalled requirements. Sharing data volumes is kind of a hack to make it really easy to keep part of a container around when you delete and recreate a container. I would love to see persistent data volumes become first class citizens so you don't have to create a separate container for them.…

Install each of the pip/bundler requirements with a separate dockerfile RUN command. Each gets cached into its own container filesystem layer that way and only new requirements are pulled. Use your favourite templating tool to generate the dockerfile with multiple run commands. I wrote djtempl ( https://github.com/emailgregn/djtempl ) for my purposes.

But let's say a dependency is changed. Won't modifying that RUN directive invalidate the cache for everything after it, potentially rebuilding a ton of stuff anyway?

Re: Developing with Docker at IFTTT

#13

Earlier quoted context omitted.

Install each of the pip/bundler requirements with a separate dockerfile RUN command. Each gets cached into its own container filesystem layer that way and only new requirements are pulled. Use your favourite templating tool to generate the dockerfile with multiple run commands. I wrote djtempl ( https://github.com/emailgregn/djtempl ) for my purposes.

But let's say a dependency is changed. Won't modifying that RUN directive invalidate the cache for everything after it, potentially rebuilding a ton of stuff anyway?

Yup, that's the trade-off.

Re: Developing with Docker at IFTTT

#14

Earlier quoted context omitted.

But let's say a dependency is changed. Won't modifying that RUN directive invalidate the cache for everything after it, potentially rebuilding a ton of stuff anyway?

Yup, that's the trade-off.

It's unfortunate that Docker uses an imperative model. A functional model would have much better cache utilization.

Re: Developing with Docker at IFTTT

#15

Very cool, we use boot2docker and a slightly modified fork of docker compose but have yet to automate installing everything. To avoid reinstalling dependencies you can use multiple dependency files to separate your slowest building dependencies (i.e for ruby you can use a Gemfile and Gemfile.tip) and a git hook script to set the modified time of all files in the repo to their last change in git: https://gist.github.c…

Thanks! We looked at the approach of adding a Gemfile.tip, however we like the data volume approach because it doesn't require any changes to the Dockerfile and it is more like what our developers are familiar with. A Gemfile.tip can become basically another Gemfile eventually, so separating the bundle step from the build step (in Development) gives us more flexibility as well as keeping things more in line with what…

I'm a bit confused by your bundler-cache. It seems you must be running `bundle install` at runtime, because you can't mount that volume during build. Am I misunderstanding?

Re: Developing with Docker at IFTTT

#16

It seems like using .dev TLD is a bad idea since Google owns it[1]. How many people use the .dev or .local TLD? What's the best practice here? [1] https://www.iana.org/domains/root/db/dev.html

.local is actually reserved for such purpose: https://en.wikipedia.org/wiki/.local

Re: Developing with Docker at IFTTT

#17

It seems like using .dev TLD is a bad idea since Google owns it[1]. How many people use the .dev or .local TLD? What's the best practice here? [1] https://www.iana.org/domains/root/db/dev.html

That's a fair point. I had been using .dev for this purpose for years, and just applied it to this project out of habit. It still doesn't fully resolve to anything from Google, but I see that ICANN is now resolving it to 127.0.53.53 to indicate a name collision. Many other projects (like Boxen) also use .dev, so it seems to still be something that people do.

Re: Developing with Docker at IFTTT

#18

It seems like using .dev TLD is a bad idea since Google owns it[1]. How many people use the .dev or .local TLD? What's the best practice here? [1] https://www.iana.org/domains/root/db/dev.html

.local is actually reserved for such purpose: https://en.wikipedia.org/wiki/.local

It seems to me that .local is reserved for purposes within a local network, not necessarily local to an individual computer itself. You could, for example, set up an internal server on your network and have it resolve with storage.local. You could argue that a collection of containers is basically the same thing, though.

Re: Developing with Docker at IFTTT

#19
post #15

Earlier quoted context omitted.

Thanks! We looked at the approach of adding a Gemfile.tip, however we like the data volume approach because it doesn't require any changes to the Dockerfile and it is more like what our developers are familiar with. A Gemfile.tip can become basically another Gemfile eventually, so separating the bundle step from the build step (in Development) gives us more flexibility as well as keeping things more in line with what…

I'm a bit confused by your bundler-cache. It seems you must be running `bundle install` at runtime, because you can't mount that volume during build. Am I misunderstanding?

That's correct. You build the image and then run (from inside a container) bundle install. This mapped well with our current flow, where you need to run bundle install after fetching new code anyway. This way, when you fetch new code, you don't need to rebuild the image and launch new containers, unless something changes in the Dockerfile or the docker-compose.yml file. That now happens fairly rarely, and, when it does, it's a pretty quick process.

You don't have to run it at runtime, however, as the data volume for a container sticks around until the container has been deleted. If you don't delete the bundler-cache container, your bundler cache sticks around. If you want to clear the cache, just remove the container.

Re: Developing with Docker at IFTTT

#20

It seems like using .dev TLD is a bad idea since Google owns it[1]. How many people use the .dev or .local TLD? What's the best practice here? [1] https://www.iana.org/domains/root/db/dev.html

.local is actually reserved for such purpose: https://en.wikipedia.org/wiki/.local

OS X does weird stuff with the .local tld, making usage of it for local hosts non-trivial. https://support.apple.com/en-us/HT201275
Post reply on HN