chore: add China mirror sources for Go and Alpine
This commit is contained in:
14
Dockerfile
14
Dockerfile
@@ -1,7 +1,14 @@
|
||||
FROM golang:1.21-alpine AS builder
|
||||
FROM golang:1.26-alpine AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# 设置 Go 国内镜像源
|
||||
RUN go env -w GOPROXY=https://goproxy.cn,direct && \
|
||||
go env -w GOSUMDB=off
|
||||
|
||||
# 设置 Alpine 国内镜像源
|
||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories
|
||||
|
||||
RUN apk add --no-cache gcc musl-dev
|
||||
|
||||
COPY go.mod go.sum ./
|
||||
@@ -11,7 +18,10 @@ COPY . .
|
||||
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o server ./cmd/server
|
||||
|
||||
FROM alpine:3.19
|
||||
FROM alpine:latest
|
||||
|
||||
# 设置 Alpine 国内镜像源
|
||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories
|
||||
|
||||
RUN apk --no-cache add ca-certificates
|
||||
|
||||
|
||||
Reference in New Issue
Block a user