Dockerfile-pip 879 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. FROM nvidia/cuda:10.2-base-ubuntu18.04
  2. # Install some basic utilities
  3. RUN apt-get update && apt-get install -y \
  4. curl \
  5. ca-certificates \
  6. sudo \
  7. git \
  8. bzip2 \
  9. libx11-6 \
  10. python3.8 \
  11. python3-pip \
  12. && apt autoclean && apt autoremove \
  13. && rm -rf /var/lib/apt/lists /var/cache/apt/archives
  14. RUN alias pip=pip3 python=python3.8
  15. RUN pip install --no-cache-dir torch opencv-python
  16. RUN rm -rf ~/.cache/pip/*
  17. # Create a working directory
  18. RUN mkdir /app
  19. WORKDIR /app
  20. # Create a non-root user and switch to it
  21. RUN adduser --disabled-password --gecos '' --shell /bin/bash user \
  22. && chown -R user:user /app
  23. RUN echo "user ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/90-user
  24. USER user
  25. # All users can use /home/user as their home directory
  26. ENV HOME=/home/user
  27. RUN chmod 777 /home/user
  28. # Set the default command to python3
  29. ENTRYPOINT [ "bash" ]