I am trying to run my django application using a docker image with a scheduled cron job.
My Dockerfile is the following
FROM python:3.8-alpine3.10
WORKDIR /OuterDirectory
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
ENV PORT=8000
RUN apk update && apk add --update alpine-sdk
RUN apk add --no-cache tini openrc busybox-initscripts
COPY requirements.txt requirements.txt
RUN pip install --upgrade pip
RUN pip install -r requirements.txt
RUN apk add --update npm
COPY . /OuterDirectory/
RUN npm install
RUN mkdir cron
RUN touch cron/cronlog.log
WORKDIR /OuterDirectory/Projectname
EXPOSE 8000
CMD python manage.py crontab add && python manage.py runserver 0.0.0.0:8000
In django settings I have properly added it to my INSTALLED_APPS.
CRONJOBS = [
('* * * * *', 'api.cron.testfunc', '>> ../cron/cronlog.log 2>&1'),
]
Everything in the docker image builds with no error.
I am 99% sure the issue is something to do with alpine linux and how to configure/get cron running on it but I am unable to find any resources. If anyone has any tips, please do help me I've been trying for a while lol