github.com/bscott/buffalo@v0.11.1/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:{{.opts.Version}} as builder
     4  
     5  RUN mkdir -p $GOPATH/src/{{.opts.App.PackagePkg}}
     6  WORKDIR $GOPATH/src/{{.opts.App.PackagePkg}}
     7  
     8  {{if .opts.App.WithWebpack -}}
     9  # this will cache the npm install step, unless package.json changes
    10  ADD package.json .
    11  {{if .opts.App.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 .opts.App.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  WORKDIR /bin/
    32  
    33  COPY --from=builder /bin/app .
    34  
    35  # Comment out to run the binary in "production" mode:
    36  # ENV GO_ENV=production
    37  
    38  # Bind the app to 0.0.0.0 so it can be seen from outside the container
    39  ENV ADDR=0.0.0.0
    40  
    41  EXPOSE 3000
    42  
    43  # Comment out to run the migrations before running the binary:
    44  # CMD /bin/app migrate; /bin/app
    45  CMD exec /bin/app