Dockerfile 868 B

1234567891011121314151617181920212223242526272829
  1. # Use an official Python runtime as a parent image
  2. FROM python:3.9
  3. # Set environment variables
  4. ENV PYTHONDONTWRITEBYTECODE 1
  5. ENV PYTHONUNBUFFERED 1
  6. ENV PYTHONPATH "src"
  7. RUN apt-get update && apt-get install -y cron
  8. # Set the working directory in the container
  9. WORKDIR /app
  10. COPY requirements.txt /app
  11. # Install any needed packages specified in requirements.txt
  12. RUN pip install --no-cache-dir -r requirements.txt
  13. # Copy the current directory contents into the container at /app
  14. COPY . /app
  15. WORKDIR /app/src
  16. # Collect static files
  17. RUN python manage.py migrate
  18. RUN python manage.py collectstatic --noinput
  19. RUN python manage.py crontab add
  20. RUN python manage.py crontab show
  21. WORKDIR /app
  22. # Make port 8000 available to the world outside this container
  23. EXPOSE 8000
  24. # Run app.py when the container launches
  25. CMD ["gunicorn", "--bind", "0.0.0.0:8000", "src.wsgi:application"]