Files
kami_backend/manifest/docker/Dockerfile
danial 4d9bf1ca97 chore(ci): 更新Docker仓库地址至git.oceanpay.cc- 修改Docker登录地址为git.oceanpay.cc
- 更新镜像构建和推送目标地址
- 调整部署阶段的Docker仓库配置
- 移除旧仓库相关环境变量引用
- 更新docker logout命令目标地址- 保持构建参数和标签策略不变
2025-10-12 19:48:57 +08:00

41 lines
1.2 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

FROM golang:1.25-alpine AS builder
ARG USE_PROXY
WORKDIR /build
COPY ./ /build/
# 根据USE_PROXY参数设置环境变量
RUN export GOPROXY=https://goproxy.cn,direct && \
export GO111MODULE=on GOOS=linux GOARCH=amd64 && \
go mod tidy && go build -ldflags "-s -w" -o main main.go
FROM alpine:latest
WORKDIR /app
ENV TZ=Asia/Shanghai
# 定义参数
ARG USE_PROXY
ENV serverName="测试"
COPY --from=builder /build/main /app/
COPY --from=builder /build/resource/public/ /app/resource/public/
COPY --from=builder /build/manifest/config/ /app/manifest/config/
#设置国内镜像源时区
RUN echo "https://mirrors.aliyun.com/alpine/v3.18/main/" > /etc/apk/repositories && \
echo "https://mirrors.aliyun.com/alpine/v3.18/community/" >> /etc/apk/repositories && \
apk update && \
apk upgrade && \
apk add --no-cache tzdata && \
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
echo "Asia/Shanghai" > /etc/timezone
#安装curl
RUN apk add --no-cache curl && chmod +x /app/main
#添加health检查
HEALTHCHECK --interval=60s --timeout=3s --retries=3 CMD curl -f http://127.0.0.1:12401/api/monitor/heathcheck || exit 1
# 启动服务
CMD ["./main"]
EXPOSE 12401