J2897 icon

Dockerfile

J2897 | PRO | 09/13/24 04:57:46 PM UTC (Edited) | 0 ⭐ | 546 👁️ | Never ⏰ | []
text |

1.81 KB

|

None

|

0 👍

/

0 👎

# Start from the latest n8n image
FROM n8nio/n8n:latest
 # Install dependencies required for Pyenv, Python builds, FFmpeg, and nano
USER root
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
 # Set environment variables for Pyenv
ENV PYENV_ROOT="/home/node/.pyenv"
ENV PATH="$PYENV_ROOT/bin:$PYENV_ROOT/shims:$PATH"
 # Install Pyenv for the 'node' user
USER node
RUN curl https://pyenv.run | bash
 # Set up Pyenv in the shell environment for the 'node' user
RUN echo 'export PYENV_ROOT="$HOME/.pyenv"' >> /home/node/.bashrc && \
    echo 'export PATH="$PYENV_ROOT/bin:$PYENV_ROOT/shims:$PATH"' >> /home/node/.bashrc && \
    echo 'eval "$(pyenv init --path)"' >> /home/node/.bashrc && \
    echo 'eval "$(pyenv init -)"' >> /home/node/.bashrc && \
    echo 'eval "$(pyenv virtualenv-init -)"' >> /home/node/.bashrc
 # Install multiple Python versions as the 'node' user
RUN bash -c "source /home/node/.bashrc && \
    pyenv install 3.9.19 && \
    pyenv install 3.10.14 && \
    pyenv install 3.11.9 && \
    pyenv install 3.12.6 && \
    pyenv global 3.12.6"
 # Create a note with details about the installed tools and build date
RUN echo '### Custom n8n Docker Image Information ###' > /home/node/BUILD_INFO.txt && \
    echo "Built on: $(date)" >> /home/node/BUILD_INFO.txt && \
    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 && \
    echo "FFmpeg installed" >> /home/node/BUILD_INFO.txt && \
    echo "Pyenv installed at $PYENV_ROOT" >> /home/node/BUILD_INFO.txt && \
    echo "Nano installed" >> /home/node/BUILD_INFO.txt && \
    chown node:node /home/node/BUILD_INFO.txt
 # Set the user back to 'node' (default user for n8n)
USER node

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎