docker_practice/image/demo/multistage-builds/Dockerfile.one

16 lines
326 B
Go
Raw Normal View History

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