Makefile for running fig

151 Views Asked by At

I try to create a make task which do fig up and install fig and docker in case when they don't installed. Problem which I try to address is a easy way to work with a project for newcomers.

I finished with something like this:

.PHONY: up

up:
    command -v docker >/dev/null 2>&1 || {\
        curl -sSL https://get.docker.com/ubuntu/ | sudo sh;\
    };\
    command -v fig >/dev/null 2>&1 || {\
        curl -L https://github.com/docker/fig/releases/download/1.0.1/fig-`uname -s`-`uname -m` > /usr/local/bin/fig; chmod +x /usr/local/bin/fig;\
    };
    fig up;

and realized that it's not a simple task. Is there a community adopted way to install and run docker and fig with make?

2

There are 2 best solutions below

0
On

I wouldn't use make for this at all.

Especially not when the commands that need to be run are so simple and single-use.

Just create a bootstrap.sh or similar script and tell people that they can run it if they need to.

0
On

I'm not going to argue if it's good practice or not, but I wrote a blog post about mixing make and fig.

http://www.byrnedo.com/2014/12/17/docker-fig-and-makefiles/

One advantage that has popped up is the fact that I can swap fig for another tool very simple. Which is relevant as that's now changing to docker-compose, so my interfacing scripts don't have to change. They still call make start or whatever when booting up a cluster.