Tonkpils / snag

Automatic build tool for all your projects
MIT License
32 stars 4 forks source link

Create Dockerfile for Snag #31

Closed Tonkpils closed 8 years ago

Tonkpils commented 9 years ago

To allow running snag and the commands from a docker container.

zabawaba99 commented 9 years ago

I started messing around with this and ran into a relatively big issue. The docker container didn't have the binaries needed to run commands in the snag.yml


The dockerfile I used

FROM golang:1.4

ENV PKG github.com/Tonkpils/snag
WORKDIR $GOPATH/src/$PKG

ADD . .

RUN go get -t
RUN go test ./...
RUN go build -o snag -ldflags '-d -w -s'

Built the container

$ docker build --tag f .
Sending build context to Docker daemon 645.6 kB
Sending build context to Docker daemon
Step 0 : FROM golang:1.4
 ---> 124e2127157f
Step 1 : ENV PKG github.com/Tonkpils/snag
 ---> Using cache
 ---> 86cc78414e58
Step 2 : WORKDIR $GOPATH/src/$PKG
 ---> Running in f1ad1b481128
 ---> 7b626ec30caa
Removing intermediate container f1ad1b481128
Step 3 : ADD . .
 ---> b83feb380c04
Removing intermediate container 68174e5fb152
Step 4 : RUN go get -t
 ---> Running in 7243fac4adf2
 ---> 987e56a8e7ff
Removing intermediate container 7243fac4adf2
Step 5 : RUN go test ./...
 ---> Running in f2ca2885fa7a
ok      github.com/Tonkpils/snag    0.005s
ok      github.com/Tonkpils/snag/vow    0.019s
 ---> 045d6498e98b
Removing intermediate container f2ca2885fa7a
Step 6 : RUN go build -o snag -ldflags '-d -w -s'
 ---> Running in f3270ab080d9
 ---> edfec5191303
Removing intermediate container f3270ab080d9
Successfully built edfec5191303

Ran it in interactive mode and ran the snag binary

$ docker run -it f bash
root@eea168719df1:/go/src/github.com/Tonkpils/snag# snag
|Passed     | go build
|Failed     | go vet
go tool: no such tool "vet"; to install:
    go get golang.org/x/tools/cmd/vet

Not too sure how to approach this so that everyone doesn't have to modify the dockerfile to add in the binaries they need.

Tonkpils commented 9 years ago

We could make a docker image that comes with snag already installed and have them build their own docker file that installs their dependencies. That's the only way I can think of approaching this.

zabawaba99 commented 9 years ago

Aye, that seems like a good approach. Only downside I see to that is that we can't shrink the docker container since we don't know what tools the consumer would need to install the binaries.

zabawaba99 commented 9 years ago

As per the comment on #39 we can't just mount a volume onto docker and have it work on every system.

One solution in mind is poll the files that we're watching and diff them to detect a change, however this would be wildly resource intensive.

Tonkpils commented 8 years ago

Closing this for now as after thinking about it it doesn't make sense to spend the time implementing this and it just doesn't seem possible at this point.