Change docker image to use cron

This commit is contained in:
Daniel M 2022-03-24 20:16:26 +01:00
parent a9dfdde9d5
commit 9207200007

View File

@ -15,9 +15,15 @@ RUN cargo build --release
################# #################
FROM debian:bullseye-slim FROM debian:bullseye-slim
# Install cron and clean default cron jobs
RUN apt-get update && apt-get install -y --no-install-recommends cron && rm -rf /etc/cron.*/*
RUN echo "0 0,12 * * * root cd /app && ./le-easy-certs >/proc/1/fd/1 2>/proc/1/fd/2\n" > /etc/crontab
RUN echo "@reboot root cd /app && ./le-easy-certs >/proc/1/fd/1 2>/proc/1/fd/2\n\n" >> /etc/crontab
WORKDIR /app WORKDIR /app
COPY --from=build /app/target/release/le-easy-certs /app/ COPY --from=build /app/target/release/le-easy-certs /app/
ENV LE_CONF=/le-conf/le-conf.toml ENV LE_CONF=/le-conf/le-conf.toml
CMD ["./le-easy-certs"] CMD [ "cron", "-f", "-l", "2" ]