-
Notifications
You must be signed in to change notification settings - Fork 42
/
Dockerfile
34 lines (24 loc) · 902 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# 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.18.1 as builder
RUN mkdir -p $GOPATH/src/gobuff_realworld_example_app
WORKDIR $GOPATH/src/gobuff_realworld_example_app
ADD . .
ENV GO111MODULES=on
RUN go get ./...
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 .
# Uncomment 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
## Add the wait script to the image
ADD https://github.com/ufoscout/docker-compose-wait/releases/download/2.9.0/wait /wait
RUN chmod +x /wait
# Run the migrations before running the binary:
CMD /wait; /bin/app migrate; /bin/app