21 lines
537 B
Docker
21 lines
537 B
Docker
ARG DOCKER_MIRROR_PREFIX=m.daocloud.io/docker.io/library
|
|
FROM ${DOCKER_MIRROR_PREFIX}/golang:1.22-bookworm
|
|
|
|
ENV GOPROXY=https://goproxy.cn,direct \
|
|
GOSUMDB=sum.golang.google.cn \
|
|
CGO_ENABLED=0
|
|
|
|
RUN sed -i 's|deb.debian.org|mirrors.aliyun.com|g' /etc/apt/sources.list.d/debian.sources \
|
|
&& sed -i 's|security.debian.org|mirrors.aliyun.com|g' /etc/apt/sources.list.d/debian.sources
|
|
|
|
WORKDIR /app
|
|
|
|
COPY go.mod ./
|
|
RUN go mod tidy || true
|
|
|
|
COPY . .
|
|
RUN go mod tidy
|
|
RUN go build -o /bin/go-service main.go
|
|
|
|
CMD ["/bin/go-service"]
|