Dockerfile 935 B

1234567891011121314151617181920212223242526272829303132
  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 && touch /var/log/cron.log
  8. RUN service cron start
  9. # Set the working directory in the container
  10. WORKDIR /app
  11. COPY requirements.txt /app
  12. # Install any needed packages specified in requirements.txt
  13. RUN pip install --no-cache-dir -r requirements.txt
  14. # Copy the current directory contents into the container at /app
  15. COPY . /app
  16. WORKDIR /app
  17. # Collect static files
  18. RUN python manage.py migrate
  19. RUN python manage.py collectstatic --noinput
  20. RUN python manage.py crontab add
  21. RUN python manage.py crontab show
  22. RUN mkdir src/artifacts
  23. WORKDIR /app
  24. # Make port 8000 available to the world outside this container
  25. EXPOSE 8000
  26. COPY start.sh /app
  27. RUN chmod +x /app/start.sh
  28. # Run app.py when the container launches
  29. CMD ["./start.sh"]