优化日志记录并改用非 root 运行

This commit is contained in:
yml2213
2026-07-29 17:01:36 +08:00
parent e5309cdf23
commit c9d0803b53
10 changed files with 102 additions and 8 deletions
+6 -1
View File
@@ -24,9 +24,14 @@ ENV TZ=Asia/Shanghai
# 国内服务器访问 dl-cdn.alpinelinux.org 常极慢,改用阿里云镜像
RUN sed -i 's#https\?://dl-cdn.alpinelinux.org/alpine#https://mirrors.aliyun.com/alpine#g' \
/etc/apk/repositories \
&& apk add --no-cache tzdata
&& apk add --no-cache tzdata \
&& addgroup -S -g 10001 app \
&& adduser -S -D -H -u 10001 -G app app \
&& mkdir -p /app/logs \
&& chown app:app /app/logs
COPY --from=build /out/hfb-api /app/hfb-api
COPY --from=build /go/bin/goose /app/goose
COPY --from=build /src/migrations /app/migrations
USER app:app
EXPOSE 8080
CMD ["/app/hfb-api"]