diff --git a/Dockerfile b/Dockerfile index a527584fb3..d03c08edf2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,11 +22,15 @@ COPY --from=build /go/apps/iotex-core/bin/actioninjectorv2 /usr/local/bin/iotex- COPY --from=build /go/apps/iotex-core/bin/addrgen /usr/local/bin/iotex-addrgen COPY --from=build /go/apps/iotex-core/bin/ioctl /usr/local/bin/ioctl -CMD [ "iotex-server"] # logrotate log file daily -RUN apk add logrotate +RUN apk add --no-cache logrotate COPY logrotate.conf /etc/logrotate.d/iotex RUN mkdir -p /var/lib/ RUN touch /var/lib/logrotate.status -RUN logrotate /etc/logrotate.d/iotex +RUN echo -e "#!/bin/sh\n\n/usr/sbin/logrotate -f /etc/logrotate.d/iotex" > /etc/periodic/daily/logrotate + +COPY entrypoint.sh /usr/local/bin +RUN chmod +x /usr/local/bin/entrypoint.sh +ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] +CMD ["iotex-server"] diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 0000000000..e1626a775d --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +/usr/sbin/crond + +exec "$@" \ No newline at end of file diff --git a/logrotate.conf b/logrotate.conf index 04bca29a6b..77af717932 100644 --- a/logrotate.conf +++ b/logrotate.conf @@ -4,4 +4,8 @@ nocompress missingok copytruncate + notifempty + dateext + dateformat -%Y-%m-%d + extension .log }