#The packaging dependency phase uses golang as the basic image FROM golang:1.14 as builder WORKDIR /app #Enable go module ENV GO111MODULE=on \ GOPROXY=https://goproxy.cn,direct \ CGO_ENABLED=0 \ GOOS=linux \ GOARCH=amd64 # Run git clone this is the githu address ##Switch to the corresponding directory go build RUN cd /app/image-merge_grpc && go build /app/image-merge_grpc ##Basic image supporting Chinese Alpine FROM frolvlad/alpine-glibc:alpine-3.11_glibc-2.30 WORKDIR /app #Copy all files in the app folder of the previous stage COPY --from=builder /app . #Copy the time zone file. I don't know if the Chinese Alpine image is available. It needs to be tested COPY --from=builder /usr/share/zoneinfo/Asia/Shanghai /etc/localtime ##To prevent the code from reporting an error when requesting HTTPS links, we need to include the certificate in the scratch COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/cert EXPOSE 50054 WORKDIR /app/image-merge_grpc ENTRYPOINT ["./imageMerge"]
version: '3' services: go_images_merge: container_ name: go_ images_ Merge \ build: ./ docker/go_ image_ Merge \dockerfile directory image: go_ images_ Merge:v1.0.3 \\image name Restart: always \ ports: - "50054:50054"
This work adoptsCC agreement, reprint must indicate the author and the link to this article