github.com/rafecolton/buffalo@v0.9.5/generators/docker/multi/templates/Dockerfile.tmpl (about) 1 # This is a multi-stage Dockerfile and requires >= Docker 17.05 2 # https://docs.docker.com/engine/userguide/eng-image/multistage-build/ 3 FROM gobuffalo/buffalo:{{.version}} as builder 4 5 RUN mkdir -p $GOPATH/src/{{.packagePath}} 6 WORKDIR $GOPATH/src/{{.packagePath}} 7 8 {{if .withWebpack -}} 9 # this will cache the npm install step, unless package.json changes 10 ADD package.json . 11 {{if .withYarn -}} 12 ADD yarn.lock . 13 RUN yarn install --no-progress 14 {{else -}} 15 RUN npm install --no-progress 16 {{end -}} 17 {{end -}} 18 19 ADD . . 20 {{if .withDep -}} 21 RUN dep ensure 22 {{else -}} 23 RUN go get $(go list ./... | grep -v /vendor/) 24 {{end -}} 25 RUN buffalo build --static -o /bin/app 26 27 FROM alpine 28 RUN apk add --no-cache bash 29 RUN apk add --no-cache ca-certificates 30 31 # Comment out to run the binary in "production" mode: 32 # ENV GO_ENV=production 33 34 WORKDIR /bin/ 35 36 COPY --from=builder /bin/app . 37 38 EXPOSE 3000 39 40 # Comment out to run the migrations before running the binary: 41 # CMD /bin/app migrate; /bin/app 42 CMD /bin/app