Grpc+protobuf learning notes III. go compile and run with docker


Written by dockerfile

#The packaging dependency phase uses golang as the basic image
FROM golang:1.14 as builder


#Enable go module
    GOPROXY=,direct \
    GOOS=linux \

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


#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"]

docker-compose. Written by YML

version: '3'
    container_ name: go_ images_ Merge \
    build: ./ docker/go_ image_ Merge \dockerfile directory
    image: go_ images_ Merge:v1.0.3 \\image name
    Restart: always \
      - "50054:50054"

This work adoptsCC agreement, reprint must indicate the author and the link to this article

Recommended Today

Using element_ Textcustomize text in ggplot2

Ggplot2’s theme system allows us to better control graphicsNon data elementTo enhance the beauty of the image through more subtle modifications,Theme system of ggplot2Self contained multipleelement_function element_text( ) element_line( ) element_rect( ) element_blank( ) This section describes the topic element element_ Text (), which controls many parts of text elements in a drawing, such as […]