# 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 # 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/src # 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 WORKDIR /app # Make port 8000 available to the world outside this container EXPOSE 8000 # Run app.py when the container launches CMD ["gunicorn", "--bind", "0.0.0.0:8000", "src.wsgi:application"]