# https://stackoverflow.com/questions/40330039/using-pyenv-activate-in-a-dockerfile FROM debian:latest RUN apt-get update RUN apt-get install -y \ sudo iproute2 iputils-ping ifupdown \ tmux nano mc git curl cmake \ npm RUN apt-get install -y \ make build-essential libssl-dev zlib1g-dev \ libbz2-dev libreadline-dev libsqlite3-dev wget llvm libncurses5-dev \ libncursesw5-dev xz-utils libffi-dev liblzma-dev RUN apt-get install -y \ default-libmysqlclient-dev pkg-config RUN useradd -ms /bin/bash user && echo "user:pass" | chpasswd && adduser user sudo USER user WORKDIR /home/user # install pyenv RUN git clone https://github.com/pyenv/pyenv .pyenv # install pyenv-virtualenv RUN git clone https://github.com/pyenv/pyenv-virtualenv .pyenv/plugins/pyenv-virtualenv ENV HOME /home/user ENV PYENV_ROOT $HOME/.pyenv ENV PATH $PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH RUN echo 'export PYENV_ROOT="$HOME/.pyenv"' >> .bashrc RUN echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> .bashrc RUN echo 'eval "$(pyenv init -)"' >> .bashrc RUN echo 'eval "$(pyenv virtualenv-init -)"' >> .bashrc RUN bash -i -c "source ~/.bashrc && env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 3.9.18" # RUN bash -i -c "source ~/.bashrc && pyenv local 3.9 && pip install jupyter jupyter-core" RUN bash -i -c "source ~/.bashrc && pyenv virtualenv 3.9.18 p3.9" # Install Poetry # RUN bash -i -c "source ~/.bashrc && pyenv activate p3.9 && \ # curl -sSL https://install.python-poetry.org | POETRY_HOME=~/opt/poetry python && \ # ~/opt/poetry/poetry config virtualenvs.create false" RUN bash -i -c "source ~/.bashrc && pyenv local 3.9.18 && \ curl -sSL https://install.python-poetry.org | POETRY_HOME=~/opt/poetry python" # RUN bash -i -c "source ~/.bashrc && \ # echo 'export PATH="/home/user/opt/poetry/bin:$PATH"' >> .bashrc" RUN git clone https://github.com/vim/vim WORKDIR /home/user/vim RUN bash -i -c "source ~/.bashrc && pyenv activate p3.9 && \ LDFLAGS=-rdynamic ./configure \ --with-features=huge \ --enable-fail-if-missing \ --enable-largefile \ --enable-multibyte \ --enable-python3interp \ --with-python3-command=python3.9 \ --with-python3-config-dir=$HOME/.pyenv/versions/3.9.18/lib/python3.9/config-3.9-x86_64-linux-gnu\ --prefix=$HOME" RUN make -j`nproc` && make install RUN curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim RUN mkdir -p ~/.vim/pack/git-plugins/start WORKDIR /home/user/ # # https://docs.python.org/3/using/cmdline.html#envvar-PYTHONDONTWRITEBYTECODE # # Prevents Python from writing .pyc files to disk ENV PYTHONDONTWRITEBYTECODE 0 # # ensures that the python output is sent straight to terminal (e.g. your container log) # # without being first buffered and that you can see the output of your application (e.g. django logs) # # in real time. Equivalent to python -u: https://docs.python.org/3/using/cmdline.html#cmdoption-u ENV PYTHONUNBUFFERED 1 ENV ENVIRONMENT prod ENV TESTING 0 # Copy poetry.lock* in case it doesn't exist in the repo COPY ./_confs/* ./ # # chown all the files to the app user # RUN chown -R user:user $HOME USER root RUN apt-get install -y \ aptitude verilator libusb-1.0-0-dev \ termshark bridge-utils \ libboost-all-dev libjsoncpp-dev # Install cmake and ELFIO RUN git clone https://github.com/serge1/ELFIO.git /home/user/ELFIO WORKDIR /home/user/ELFIO RUN cmake . RUN make -j`nproc` && sudo make install USER user RUN bash -i -c "source ~/.bashrc && pyenv activate p3.9 && pip install ipython" RUN bash -i -c "source ~/.bashrc && pyenv activate p3.9 && pip install mysqlclient sqlalchemy" RUN echo 'export PATH=$PATH:/home/user/riscv/riscv/bin' >> ~/.bashrc RUN echo 'export PATH=$PATH:/home/user/riscv/esp-gdb/riscv32-esp-elf-gdb/bin' >> ~/.bashrc RUN echo 'export PATH=$PATH:/home/user/opt/poetry/bin' >> ~/.bashrc RUN wget -P ~ https://git.io/.gdbinit EXPOSE 8080 CMD ["python", "-m", "http.server", "8080"]