Dockerfile 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. FROM continuumio/miniconda3:23.5.2-0
  2. RUN apt-get update && apt-get install locate sudo
  3. RUN conda create -n env python=3.10
  4. RUN conda init bash
  5. # RUN cd / | tar -czvf venv.tar.gz venv
  6. # Copy requirements.txt and install dependencies
  7. COPY requirements.txt .
  8. RUN conda run -n env pip install --no-cache-dir -r requirements.txt
  9. RUN pip install --no-cache-dir conda-pack
  10. # RUN cd /venv && tar -czvf ../venv.tar.gz * && chmod 777 ../venv.tar.gz
  11. # RUN stat /venv.tar.gz
  12. RUN conda-pack -n env -o /venv.tar.gz && chmod 777 /venv.tar.gz
  13. # set new user
  14. RUN echo "meowuser ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers \
  15. && groupadd -g 9882 meowuser && useradd -u 9882 -g 9882 meowuser
  16. RUN echo "meowuser ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
  17. # Create the home directory for meowuser
  18. RUN mkdir -p /home/meowuser && \
  19. chown meowuser:meowuser /home/meowuser
  20. # Set the working directory to /home/meowuser
  21. WORKDIR /home/meowuser
  22. USER meowuser
  23. RUN cp /venv.tar.gz /home/meowuser
  24. # Copy the rest of the application code
  25. COPY app.py /home/meowuser
  26. # tar -czvf archive.tar.gz folder_name
  27. # Set the command to run the application
  28. CMD [ "python", "app.py" ]