FROM golang:1.18 as builder ENV GO111MODULE=on \ GOPROXY=https://goproxy.io COPY . /app WORKDIR /app RUN go get && go build -ldflags="-s -w" -installsuffix cgo -o hello FROM alpine:latest ENV TZ=Asia/Shanghai \ LANG=C.UTF-8 \ APP_DIR=/app COPY --from=builder /app/hello ${APP_DIR}/hello WORKDIR ${APP_DIR} RUN ln -snf /usr/share/zoneinfo/${TZ} /etc/localtime \ && echo ${TZ} > /etc/timezone \ && chmod +x hello # EXPOSE 5678 CMD ["./hello"]