Closed Luchanso closed 4 years ago
Thank you guys, I solve this via nodejs
FROM renovate/renovate:slim
WORKDIR /usr/src
COPY ./config.js ./app
COPY ./src ./cron/src
COPY ./yarn.lock ./cron
COPY ./package.json ./cron
USER root
RUN cd ./cron && yarn
USER 1000
CMD ["node", "./cron/src/index.js"]
const { CronJob } = require("cron");
const { spawn } = require("child_process");
function executeRenovate() {
const renovate = spawn("docker-entrypoint.sh", {
cwd: '/usr/src/app',
stdio: "inherit",
stderr: "inherit",
});
renovate.on('close', (code) => {
if (code !== 0) {
job.stop();
console.error('Failed in renovate. Return code', code);
process.exit(code);
}
console.log(`Renovate exited with code ${code}`);
});
renovate.on('error', (err) => {
job.stop();
console.error('Failed in renovate. Return code');
console.error(err);
process.exit(1);
});
}
// everyday at 00:00 https://crontab.guru/#0_0_*_*_*
var job = new CronJob("0 0 * * *", () => {
console.log('--- CRON JOB CALL ---');
executeRenovate();
});
console.log('--- CRON JOB START ---');
job.start();
executeRenovate();
Which Renovate are you using?
Renovate Open Source CLI
Which platform are you using?
Bitbucket Server
What would you like to do?
Hi, guys, I write docker image with cron tab and can't run renovate on schedule, maybe because base image use dumb-init (but I'm not sure).
My dockerfile:
In cron-renovate-scheduler, wrote
* * * * * root echo hello > /proc/1/fd/1 2>/proc/1/fd/2
After build and run, I got just runned once renovate application and after container automatically destroy - without "hello" 😢