Alpine CDN unreachable from DinD containers. Switch to mirrors.aliyun.com for both builder and runtime stages. Co-Authored-By: Claude <noreply@anthropic.com>
21 lines
740 B
Docker
21 lines
740 B
Docker
ARG BASE_REGISTRY=harbor-in-k3s.cheverjohn.me/library
|
|
FROM ${BASE_REGISTRY}/golang:1.24-alpine AS builder
|
|
ENV GOPROXY=https://goproxy.cn,direct
|
|
RUN sed -i "s|dl-cdn.alpinelinux.org|mirrors.aliyun.com|g" /etc/apk/repositories
|
|
RUN apk add --no-cache git
|
|
WORKDIR /app
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
COPY . .
|
|
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /server ./gateway/gateway.go
|
|
|
|
FROM ${BASE_REGISTRY}/alpine:3.20
|
|
RUN sed -i "s|dl-cdn.alpinelinux.org|mirrors.aliyun.com|g" /etc/apk/repositories
|
|
RUN apk add --no-cache ca-certificates tzdata
|
|
WORKDIR /app
|
|
COPY --from=builder /server ./gateway
|
|
COPY deploy/etc/gateway.yaml etc/gateway.yaml
|
|
COPY deploy/tools/ tools/
|
|
EXPOSE 8888
|
|
CMD ["./gateway", "-f", "etc/gateway.yaml"]
|