Dockerfile 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. # yup, python 3.11!
  2. FROM python:3.11-slim
  3. # install nginx
  4. RUN apt-get update && apt-get install nginx netcat-openbsd rsync -y
  5. # copy our nginx configuration to overwrite nginx defaults
  6. RUN rm /etc/nginx/sites-enabled/default
  7. RUN rm /etc/nginx/sites-available/default
  8. COPY ./nginx/default.conf /etc/nginx/conf.d/default.conf
  9. # link nginx logs to container stdout
  10. RUN ln -sf /dev/stdout /var/log/nginx/access.log && ln -sf /dev/stderr /var/log/nginx/error.log
  11. # copy the django code
  12. COPY ./src ./app
  13. RUN chgrp -R 0 ./app && chmod -R g=u ./app
  14. RUN chgrp -R 0 /var/lib/nginx && chmod -R g=u /var/lib/nginx
  15. # change our working directory to the django projcet roo
  16. WORKDIR /app
  17. # create virtual env (notice the location?)
  18. # update pip
  19. # install requirements
  20. RUN python -m venv /opt/venv && \
  21. /opt/venv/bin/python -m pip install pip --upgrade && \
  22. /opt/venv/bin/python -m pip install -r requirements.txt
  23. # make our entrypoint.sh executable
  24. RUN chmod +x config/entrypoint.sh
  25. # execute our entrypoint.sh file
  26. CMD ["./config/entrypoint.sh"]