# Use an official Python runtime as a parent image FROM python:3.9 # Set environment variables ENV PYTHONDONTWRITEBYTECODE 1 ENV PYTHONUNBUFFERED 1 ENV PYTHONPATH "src" RUN apt-get update && apt-get install -y cron && touch /var/log/cron.log RUN service cron start # Set the working directory in the container WORKDIR /app COPY requirements.txt /app # Install any needed packages specified in requirements.txt RUN pip install --no-cache-dir -r requirements.txt # Copy the current directory contents into the container at /app COPY . /app WORKDIR /app # Collect static files RUN python manage.py migrate RUN python manage.py collectstatic --noinput RUN python manage.py crontab add RUN python manage.py crontab show RUN mkdir src/artifacts WORKDIR /app # Make port 8000 available to the world outside this container EXPOSE 8000 COPY start.sh /app RUN chmod +x /app/start.sh # Run app.py when the container launches CMD ["./start.sh"]