-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dockerfile to run Shreddit as an hourly cron job #100
base: master
Are you sure you want to change the base?
Conversation
I personally would be absolutely happy to have a docker file to do exactly this. Hourly is a little often but weekly would be absolutely fantastic. |
|
||
COPY . /shreddit | ||
WORKDIR /shreddit | ||
RUN pip install -r requirements.txt && python setup.py install |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider seperating the copy of requirements.txt
and everything else so Docker caches the install. Something like:
WORKDIR /shreddit
COPY requirements.txt ./
RUN pip install -r requirements.txt
COPY . ./
RUN python setup.py install
Changes to anything but requirements.txt
will not require a reinstall when the container is rebuilt -- it'll just start at the python setup.py install
I'd go with daily. Seems like a nice compromise. |
This absolutely needs to happen, is it? Running Shreddit manually is a pain. Someone? |
For now you could use a timer, or a cron job :) |
Would you mind quickly telling me how to do this? I'd like to have it setup on a server that is always running so it actually does do this properly. I guess I'd need to install python or something too of course. I'm not using any VMs on my server, just Docker. Is it possible to do it with that or? |
Well, on your host system you should add an entry to the crontab, which executes the script (doesn't matter if within a docker container or not) in a specific interval. The entry in the crontab for running the script, for example, every 15 minutes within a docker container could look like this:
|
I made an image this week which has support for any CRON schedule: https://github.com/MitchTalmadge/shreddit-dockerized Enjoy |
https://github.com/kusold/Shreddit I setup automatic publishing of docker images on my repo. It does not include cron inside the image, you can manage that with k8s, or just a host level cron job. My fork also makes this compatible with Python 3. |
I was wondering if you would be interested in having a docker image for this repo. DockerHub provides automated docker builds if you setup an integration with Github, so once it is setup things should be pretty hands off unless the installation steps change.
If you are not interested in having the dockerfile be part of your project, I can manage the dockerfile in a separate repo. If this happens, would you be interested in adding a
push_event
so that I can have the image rebuild each time you commit?