2017-11-24 10:36:30 +00:00
|
|
|
FROM golang:1.9-alpine
|
2017-11-24 10:37:38 +00:00
|
|
|
|
2017-11-24 10:36:30 +00:00
|
|
|
RUN apk --no-cache add git
|
2017-11-24 10:37:38 +00:00
|
|
|
|
2017-11-24 10:36:30 +00:00
|
|
|
WORKDIR /go/src/github.com/go/helloworld/
|
2017-11-24 10:37:38 +00:00
|
|
|
|
2017-11-24 10:36:30 +00:00
|
|
|
RUN go get -d -v github.com/go-sql-driver/mysql
|
2017-11-24 10:37:38 +00:00
|
|
|
|
2017-11-24 10:36:30 +00:00
|
|
|
COPY app.go .
|
2017-11-24 10:37:38 +00:00
|
|
|
|
2017-11-24 10:36:30 +00:00
|
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app .
|
|
|
|
|
|
|
|
FROM alpine:latest
|
2017-11-24 10:37:38 +00:00
|
|
|
|
2017-11-24 10:36:30 +00:00
|
|
|
RUN apk --no-cache add ca-certificates
|
2017-11-24 10:37:38 +00:00
|
|
|
|
2017-11-24 10:36:30 +00:00
|
|
|
WORKDIR /root/
|
2017-11-24 10:37:38 +00:00
|
|
|
|
2017-11-24 10:36:30 +00:00
|
|
|
COPY --from=0 /go/src/github.com/go/helloworld/app .
|
2017-11-24 10:37:38 +00:00
|
|
|
|
2017-11-24 10:36:30 +00:00
|
|
|
CMD ["./app"]
|