Created
April 17, 2018 23:10
-
-
Save keidrun/bd9913901e8eeb9acbd4cd64f2922bb1 to your computer and use it in GitHub Desktop.
Simple Clock process as Docker container to prevent idling for free dyno on Heroku
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const http = require('http'); | |
const ACCESS_URL = 'http://my-herokuapp.herokuapp.com'; | |
const INTERVAL_MSEC = 10 * 60 * 1000; // every 10 minutes | |
setInterval(() => { | |
http | |
.get(ACCESS_URL, res => { | |
console.log(res.statusCode, res.statusMessage, ACCESS_URL); | |
}) | |
.on('error', err => { | |
console.log(err, ACCESS_URL); | |
}); | |
}, INTERVAL_MSEC); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM node:9.11.1-alpine | |
LABEL maintainer="Keid" | |
RUN mkdir /app | |
WORKDIR /app | |
COPY clock.js clock.js | |
CMD node clock.js |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment