dockerfile编写
FROM golang:1.14 as builder
WORKDIR /app
ENV GO111MODULE=on \
GOPROXY=https://goproxy.cn,direct \
CGO_ENABLED=0 \
GOOS=linux \
GOARCH=amd64
RUN git clone 这里是githu地址
RUN cd /app/image-merge_grpc && go build /app/image-merge_grpc
FROM frolvlad/alpine-glibc:alpine-3.11_glibc-2.30
WORKDIR /app
COPY --from=builder /app .
COPY --from=builder /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/cert
EXPOSE 50054
WORKDIR /app/image-merge_grpc
ENTRYPOINT ["./imageMerge"]
docker-compose.yml 编写
version: '3'
services:
go_images_merge:
container_name: go_images_merge
build: ./docker/go_image_merge
image: go_images_merge:v1.0.3
restart: always
ports:- "50054:50054"
《Grpc+Protobuf学习笔记》一、前言
《Grpc+Protobuf学习笔记》三、go使用docker编译运行