hello/service/echo/Dockerfile

23 lines
439 B
Docker
Raw Normal View History

2024-03-19 14:12:40 +08:00
FROM golang:1.20.14-alpine3.19 AS builder
WORKDIR /app/build
COPY go.mod .
COPY go.sum .
2024-04-03 14:02:28 +08:00
COPY service/echo/main.go .
2024-03-19 14:12:40 +08:00
ENV GOPROXY https://goproxy.io
2024-04-03 14:02:28 +08:00
RUN go mod download && go build -ldflags='-s -w' -o echo_app .
2024-03-19 14:12:40 +08:00
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
2024-04-03 14:02:28 +08:00
COPY --from=builder /app/build/echo_app .
2024-03-19 14:12:40 +08:00
2024-04-03 14:02:28 +08:00
CMD [ "/app/echo_app" ]