From 4e1b40521b7c3b56cd5ed95f0802c925e1d54445 Mon Sep 17 00:00:00 2001 From: u1 Date: Wed, 6 Nov 2024 09:26:14 +0000 Subject: [PATCH] u --- Dockerfile | 84 +++++++++++------------ __n1 | 1 - __run2 | 2 +- app/__pycache__/database.cpython-312.pyc | Bin 981 -> 981 bytes 4 files changed, 41 insertions(+), 46 deletions(-) diff --git a/Dockerfile b/Dockerfile index b6e0e91..08c6e88 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ -# Choose a base image. Debian is a good choice due to pyenv +# Wybierz bazowy obraz. Debian jest dobrym wyborem ze względu na pyenv FROM debian:latest -# Update the package list and install necessary dependencies +# Aktualizacja listy pakietów i instalacja niezbędnych zależności RUN apt-get update && apt-get install -y \ aptitude \ tmux vim-nox nano mc git curl termshark procps \ @@ -13,71 +13,67 @@ RUN apt-get update && apt-get install -y \ python3-pip \ npm -# Set password for root user (optional, for configuration) +# Ustawienie hasła dla użytkownika root (opcjonalne, do konfiguracji) RUN echo 'root:rootpass' | chpasswd -# Add a new user `user` with password `pass` and prepare the environment +# Dodanie nowego użytkownika `user` z hasłem `pass` i przygotowanie środowiska RUN useradd -m user && echo 'user:pass' | chpasswd && adduser user sudo -# Switch to user `user` +# Przełączenie na użytkownika `user` 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 - -# Set environment variables -ENV HOME /home/user +# Ustawienie zmiennych środowiskowych +ENV HOME /home/user ENV PYENV_ROOT $HOME/.pyenv -ENV PATH $PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH +ENV PATH $PYENV_ROOT/shims:$PYENV_ROOT/bin:$HOME/.local/bin:$PATH +ENV PYENV_VERSION p3.12 -# Add pyenv and pyenv-virtualenv configuration to .bashrc -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 +# Instalacja pyenv +RUN git clone https://github.com/pyenv/pyenv $PYENV_ROOT -# Install Python 3.12 with --enable-shared -RUN bash -i -c "source ~/.bashrc && env PYTHON_CONFIGURE_OPTS='--enable-shared' pyenv install 3.12" +# Instalacja pyenv-virtualenv +RUN git clone https://github.com/pyenv/pyenv-virtualenv $PYENV_ROOT/plugins/pyenv-virtualenv -# Create a virtual environment p3.12 -RUN bash -i -c "source ~/.bashrc && pyenv virtualenv 3.12 p3.12" +# Dodanie konfiguracji pyenv i pyenv-virtualenv do .bashrc +RUN echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc \ + && echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc \ + && echo 'eval "$(pyenv init --path)"' >> ~/.bashrc \ + && echo 'eval "$(pyenv init -)"' >> ~/.bashrc \ + && echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bashrc -# Set p3.12 as the default virtual environment -RUN bash -i -c "source ~/.bashrc && pyenv local p3.12" +# Instalacja Pythona 3.12 z --enable-shared +RUN env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 3.12.0 -# Install ipython in the p3.12 environment -RUN bash -i -c "source ~/.bashrc && pyenv activate p3.12 && pip install ipython" +# Utworzenie środowiska wirtualnego p3.12 +RUN pyenv virtualenv 3.12.0 p3.12 -# Install Vim-Plug for Vim plugin management +# Ustawienie p3.12 jako globalnego środowiska +RUN pyenv global p3.12 + +# Instalacja ipython w środowisku p3.12 +RUN pip install ipython + +# Instalacja Vim-Plug do zarządzania wtyczkami Vim RUN curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim -# Copy the vim configuration file for plugins -COPY ./_confs/.vimrc /home/user/.vimrc +# Kopiowanie plików konfiguracyjnych vim i tmux +COPY --chown=user:user ./_confs/.vimrc /home/user/.vimrc +COPY --chown=user:user ./_confs/.tmux.conf /home/user/.tmux.conf -# Install Vim plugins via Vim-Plug +# Instalacja wtyczek Vim za pomocą Vim-Plug RUN vim +'PlugInstall --sync' +qall -# Install Poetry +# Instalacja Poetry w środowisku p3.12 RUN curl -sSL https://install.python-poetry.org | python3 - -# Copy the project into the image +# Kopiowanie projektu do obrazu COPY --chown=user:user . /home/user/fapi -COPY ./_confs/* ./ -# Set the working directory for installing dependencies -WORKDIR /home/user/fapi +# Instalacja zależności za pomocą Poetry z głównego katalogu +RUN cd /home/user/fapi && poetry config virtualenvs.create false && poetry install -# Add Poetry path to PATH directly in the Dockerfile -ENV PATH="$HOME/.local/bin:$PATH" - -# Install dependencies using Poetry -RUN bash -i -c "source ~/.bashrc && poetry config virtualenvs.create false && poetry install" - -# Run the application -CMD ["/bin/bash", "-c", "python entrypoint.py"] +# Uruchomienie aplikacji +CMD ["python", "/home/user/fapi/entrypoint.py"] diff --git a/__n1 b/__n1 index 15e64e4..fd976cf 100644 --- a/__n1 +++ b/__n1 @@ -1,7 +1,6 @@ sudo docker run --rm \ -dit \ --privileged \ - -p 9999:9999 \ -p 8888:8888 \ -v /home/user/work/fapi/fapi/src:/home/user/fapi \ --name f1 \ diff --git a/__run2 b/__run2 index fa1d752..ec93107 100644 --- a/__run2 +++ b/__run2 @@ -1 +1 @@ -docker run --rm -it -p 9999:9999 --name cfapi fapi bash +docker run --rm -it -p 8888:8888 --name cfapi fapi bash diff --git a/app/__pycache__/database.cpython-312.pyc b/app/__pycache__/database.cpython-312.pyc index 15fbdf45c4c8f9b366b38e2c874690db0b0f4101..d3371508eda900b45a1c2f3bd3ce40301d7c0f51 100644 GIT binary patch delta 20 acmcc0ewCg3G%qg~0}uphsBPpv#S8#9f&|