From bb3d4ac60f94afc5f4cd72b92ab2f65ec27773d2 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Tue, 19 Mar 2024 10:51:37 +0800 Subject: [PATCH] update --- Dockerfile | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index c5905d1..1dbf7e7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ # 多重构建,减少镜像大小 # 构建:使用golang:1.15版本 -FROM golang:1.15 as build +FROM golang:1.18 as build # 容器环境变量添加,会覆盖默认的变量值 ENV GO111MODULE=on @@ -24,11 +24,19 @@ COPY static/html static/html RUN rm -f /etc/localtime \ && ln -sv /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \ && echo "Asia/Shanghai" > /etc/timezone + + +# 优化内核参数 +#RUN sysctl -w net.ipv4.tcp_fin_timeout=15 +#RUN sysctl -w net.ipv4.tcp_tw_recycle=1 +#RUN sysctl -w net.ipv4.ip_local_port_range=1024 65535 +#RUN sysctl -p # 在build阶段复制可执行的go二进制文件app COPY --from=build /go/release/zyos ./zyos COPY --from=build /go/release/etc/cfg.yml /var/zyos/cfg.yml # 启动服务 -CMD ["./zyos","-c","/var/zyos/cfg.yml"] +#CMD ["./zyos","-c","/var/zyos/cfg.yml"] +CMD ["bash","-c","sysctl -w net.ipv4.ip_local_port_range='1024 65535' && sysctl -p && ./zyos -c /var/zyos/cfg.yml"]