1.修改代码适配阿里云的服务器
This commit is contained in:
@@ -1,8 +1,12 @@
|
||||
# 需在项目根目录构建: docker build -f server/Dockerfile .
|
||||
# 使用 vendor 构建,无需在构建时访问 proxy.golang.org(服务器无外网时也能 build)
|
||||
FROM golang:1.21-alpine AS builder
|
||||
WORKDIR /build
|
||||
COPY server/ ./
|
||||
RUN go mod download && CGO_ENABLED=0 go build -o /app/server .
|
||||
# 构建参数:脚本可传 GOPROXY,避免 proxy.golang.org 超时;有 vendor 时主要用 -mod=vendor 离线构建
|
||||
ARG GOPROXY=https://goproxy.cn,direct
|
||||
ENV GOPROXY=$GOPROXY
|
||||
RUN CGO_ENABLED=0 go build -mod=vendor -o /app/server .
|
||||
|
||||
FROM alpine:3.19
|
||||
WORKDIR /app
|
||||
|
||||
Reference in New Issue
Block a user