优化日志记录并改用非 root 运行
This commit is contained in:
+6
-1
@@ -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"]
|
||||
|
||||
Reference in New Issue
Block a user