Files
admin 9b33b3f4fb
Deploy ai-agent to dev k3s / build-and-deploy (push) Successful in 4m1s
fix: Dockerfile 换阿里云 apk 源,避免构建卡死
2026-08-03 14:18:48 +08:00

27 lines
570 B
Docker

# 阶段1: 构建
FROM golang:alpine AS builder
# 换国内源,避免 apk 从官方源超时
RUN sed -i 's|dl-cdn.alpinelinux.org|mirrors.aliyun.com|g' /etc/apk/repositories \
&& apk add --no-cache git ca-certificates tzdata
ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
ENV GO111MODULE=on
ENV GOPROXY=https://goproxy.cn,direct
ENV CGO_ENABLED=0
ENV GOTOOLCHAIN=auto
WORKDIR /build
COPY . .
RUN go mod download && go mod tidy
RUN go build -ldflags="-s -w" -o main ./main.go
EXPOSE 3005
CMD ["./main"]