Κωνσταντίνος Χάρλαν

The simple solutions are the best solutions

November 16, 2017

Earlier today I began to see build errors on a client project: The command "sudo apt-get update" failed and exited with 100 during . As noted in a previous post, I’ve been updating Travis boxes to use the latest version of Docker, so that both Travis and our local developer environments can make use of the :cached flag. It looks like at some point today, the package repository for the Ubuntu box wasn’t available.

When the build problems occurred, I started looking into defining a variable in the Makefile so that docker-compose would conditionally be docker-compose up -d .docker/docker-compose.travis.yml docker-compose.yml, and contain any Travis specific overrides in the first of those files. But then I realized I’d need to then maintain three files (base, local, Travis) since it’s not possible to override the volume directives. (Maybe I missed something.) This is more complication than it’s worth.

Then I realized, all I really need to do is remove the string :cached from docker-compose.yml when in Travis. So, in .travis.yml:

install:
- sed -i 's/:cached//' docker-compose.yml

And we’re done. The simplest solutions are the best ones.


Ίντα `χετε γύρου-γύρου ...