hello/service/echo/Dockerfile
2024-04-05 12:47:51 +08:00

25 lines
459 B
Docker

FROM golang:latest AS builder
WORKDIR /app/build
COPY go.mod .
COPY go.sum .
COPY service/echo/main.go .
ENV GOPROXY https://goproxy.io
ENV GOOS linux
ENV GOARCH amd64
RUN go mod download && go build -ldflags='-s -w' -o echo_app .
FROM alpine
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories && apk add curl
ENV TZ Asia/Shanghai
WORKDIR /app
COPY --from=builder /app/build/echo_app .
CMD [ "/app/echo_app" ]