Last Updated: July 24, 2017
·
311
· baldrailers

Update dependencies when using Docker for Gobuffalo

If you have been playing with buffalo I'm pretty sure you've stumbled upon one of their tutorials about Deploying Buffalo to Heroku with Docker.

Following the tutorial / blog-post makes a lot of sense, it'll get you going with Heroku and Buffalo. I did hit some snag adding go dependencies and libraries, specially when building the docker-image. The base generated Dockerfile is missing a line to add the new dependencies.

FROM gobuffalo/buffalo:v0.9.1.2

RUN mkdir -p $GOPATH/src/gitlab.com/<GITHUB_USERNAME>/coke
WORKDIR $GOPATH/src/gitlab.com/<GITHUB_USERNAME>/coke

# this will cache the npm install step, unless package.json changes
ADD package.json .
RUN npm install
ADD . .
RUN buffalo build --static -o /bin/app

EXPOSE 3000

# Comment out to run the migrations before running the binary:
# CMD /bin/app migrate; /bin/app
CMD /bin/app

You should add: RUN go get ./...

...
ADD . .
RUN go get ./...
RUN buffalo build --static -o /bin/app
...