# 截取自: https://stackoverflow.com/a/52191994 # 你可以在这里找到其他的脚本. docker build . -t test --no-cache | whileread line ; doecho"$(date)| $line"; done;
Fri 08 Nov 2019 09:20:54 AM HKT| Sending build context to Docker daemon 8.192kB Fri 08 Nov 2019 09:20:55 AM HKT| Step 1/5 : FROM node:10.17.0-alpine Fri 08 Nov 2019 09:20:55 AM HKT| ---> 0aa7bb41deca Fri 08 Nov 2019 09:20:55 AM HKT| Step 2/5 : COPY main.js main.js Fri 08 Nov 2019 09:20:55 AM HKT| ---> 05c746d8951a Fri 08 Nov 2019 09:20:55 AM HKT| Step 3/5 : COPY full-run.sh /run.sh Fri 08 Nov 2019 09:20:55 AM HKT| ---> 3a44ba811766 Fri 08 Nov 2019 09:20:55 AM HKT| Step 4/5 : RUN chmod +x /run.sh Fri 08 Nov 2019 09:20:56 AM HKT| ---> Running in 2ceec4735960 Fri 08 Nov 2019 09:20:57 AM HKT| Removing intermediate container 2ceec4735960 Fri 08 Nov 2019 09:20:57 AM HKT| ---> 8baf4c5d9284 Fri 08 Nov 2019 09:20:57 AM HKT| Step 5/5 : ENTRYPOINT ["/run.sh"] Fri 08 Nov 2019 09:20:57 AM HKT| ---> Running in 1ebf29aa5b85 Fri 08 Nov 2019 09:20:57 AM HKT| Removing intermediate container 1ebf29aa5b85 Fri 08 Nov 2019 09:20:57 AM HKT| ---> 9cb776220122 Fri 08 Nov 2019 09:20:57 AM HKT| Successfully built 9cb776220122 Fri 08 Nov 2019 09:20:57 AM HKT| Successfully tagged test:latest
FROM golang:1.7.3 WORKDIR /go/src/github.com/alexellis/href-counter/ RUN go get -d -v golang.org/x/net/html COPY app.go . RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app .
FROM alpine:latest RUN apk --no-cache add ca-certificates WORKDIR /root/ COPY --from=0 /go/src/github.com/alexellis/href-counter/app . CMD ["./app"]