Created
January 21, 2018 18:08
-
-
Save ntakouris/199c5beffcc171d6c48721342db580c9 to your computer and use it in GitHub Desktop.
gobuffalo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a multi-stage Dockerfile and requires >= Docker 17.05 | |
# https://docs.docker.com/engine/userguide/eng-image/multistage-build/ | |
FROM gobuffalo/buffalo:v0.10.3 as builder | |
RUN mkdir -p $GOPATH/src/github.com/username/app-name | |
WORKDIR $GOPATH/src/github.com/username/app-name | |
# this will cache the npm install step, unless package.json changes | |
ADD package.json . | |
ADD yarn.lock . | |
RUN yarn install --no-progress | |
ADD . . | |
RUN go get $(go list ./... | grep -v /vendor/) | |
RUN buffalo build --static -o /bin/app | |
FROM alpine | |
RUN apk add --no-cache bash | |
RUN apk add --no-cache ca-certificates | |
WORKDIR /bin/ | |
COPY --from=builder /bin/app . | |
# Comment out to run the binary in "production" mode: | |
# ENV GO_ENV=production | |
# Bind the app to 0.0.0.0 so it can be seen from outside the container | |
ENV ADDR=0.0.0.0 | |
EXPOSE 3000 | |
# Comment out to run the migrations before running the binary: | |
# CMD /bin/app migrate; /bin/app | |
CMD exec /bin/app |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment