Advertisement
J2897

Dockerfile

Sep 12th, 2024 (edited)
24
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.81 KB | None | 0 0
  1. # Start from the latest n8n image
  2. FROM n8nio/n8n:latest
  3.  
  4. # Install dependencies required for Pyenv, Python builds, FFmpeg, and nano
  5. USER root
  6. RUN apk add --no-cache bash curl git make gcc g++ zlib-dev bzip2-dev readline-dev sqlite-dev openssl-dev tk-dev libffi-dev linux-headers xz-dev ffmpeg nano
  7.  
  8. # Set environment variables for Pyenv
  9. ENV PYENV_ROOT="/home/node/.pyenv"
  10. ENV PATH="$PYENV_ROOT/bin:$PYENV_ROOT/shims:$PATH"
  11.  
  12. # Install Pyenv for the 'node' user
  13. USER node
  14. RUN curl https://pyenv.run | bash
  15.  
  16. # Set up Pyenv in the shell environment for the 'node' user
  17. RUN echo 'export PYENV_ROOT="$HOME/.pyenv"' >> /home/node/.bashrc && \
  18. echo 'export PATH="$PYENV_ROOT/bin:$PYENV_ROOT/shims:$PATH"' >> /home/node/.bashrc && \
  19. echo 'eval "$(pyenv init --path)"' >> /home/node/.bashrc && \
  20. echo 'eval "$(pyenv init -)"' >> /home/node/.bashrc && \
  21. echo 'eval "$(pyenv virtualenv-init -)"' >> /home/node/.bashrc
  22.  
  23. # Install multiple Python versions as the 'node' user
  24. RUN bash -c "source /home/node/.bashrc && \
  25. pyenv install 3.9.19 && \
  26. pyenv install 3.10.14 && \
  27. pyenv install 3.11.9 && \
  28. pyenv install 3.12.6 && \
  29. pyenv global 3.12.6"
  30.  
  31. # Create a note with details about the installed tools and build date
  32. RUN echo '### Custom n8n Docker Image Information ###' > /home/node/BUILD_INFO.txt && \
  33. echo "Built on: $(date)" >> /home/node/BUILD_INFO.txt && \
  34. echo "Installed Python versions: 3.9.19, 3.10.14, 3.11.9, 3.12.6 (default: 3.12.6)" >> /home/node/BUILD_INFO.txt && \
  35. echo "FFmpeg installed" >> /home/node/BUILD_INFO.txt && \
  36. echo "Pyenv installed at $PYENV_ROOT" >> /home/node/BUILD_INFO.txt && \
  37. echo "Nano installed" >> /home/node/BUILD_INFO.txt && \
  38. chown node:node /home/node/BUILD_INFO.txt
  39.  
  40. # Set the user back to 'node' (default user for n8n)
  41. USER node
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement