Dockerfile 957 B

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