Compare commits
1 Commits
mpabi
...
mpabi-p25.
Author | SHA1 | Date |
---|---|---|
mpabi | 9d3f6fa112 |
82
Dockerfile
82
Dockerfile
|
@ -1,7 +1,7 @@
|
|||
# Wybierz bazowy obraz. Debian jest dobrym wyborem ze względu na pyenv
|
||||
# Choose a base image. Debian is a good choice due to pyenv
|
||||
FROM debian:latest
|
||||
|
||||
# Aktualizacja listy pakietów i instalacja niezbędnych zależności
|
||||
# Update the package list and install necessary dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
aptitude \
|
||||
tmux vim-nox nano mc git curl termshark procps \
|
||||
|
@ -13,67 +13,71 @@ RUN apt-get update && apt-get install -y \
|
|||
python3-pip \
|
||||
npm
|
||||
|
||||
# Ustawienie hasła dla użytkownika root (opcjonalne, do konfiguracji)
|
||||
# Set password for root user (optional, for configuration)
|
||||
RUN echo 'root:rootpass' | chpasswd
|
||||
|
||||
# Dodanie nowego użytkownika `user` z hasłem `pass` i przygotowanie środowiska
|
||||
# Add a new user `user` with password `pass` and prepare the environment
|
||||
RUN useradd -m user && echo 'user:pass' | chpasswd && adduser user sudo
|
||||
|
||||
# Przełączenie na użytkownika `user`
|
||||
# Switch to user `user`
|
||||
USER user
|
||||
WORKDIR /home/user
|
||||
|
||||
# Ustawienie zmiennych środowiskowych
|
||||
# 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
|
||||
ENV PYENV_ROOT $HOME/.pyenv
|
||||
ENV PATH $PYENV_ROOT/shims:$PYENV_ROOT/bin:$HOME/.local/bin:$PATH
|
||||
ENV PYENV_VERSION p3.12
|
||||
ENV PATH $PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH
|
||||
|
||||
# Instalacja pyenv
|
||||
RUN git clone https://github.com/pyenv/pyenv $PYENV_ROOT
|
||||
# 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-virtualenv
|
||||
RUN git clone https://github.com/pyenv/pyenv-virtualenv $PYENV_ROOT/plugins/pyenv-virtualenv
|
||||
# Install Python 3.12 with --enable-shared
|
||||
RUN bash -i -c "source ~/.bashrc && env PYTHON_CONFIGURE_OPTS='--enable-shared' pyenv install 3.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
|
||||
# Create a virtual environment p3.12
|
||||
RUN bash -i -c "source ~/.bashrc && pyenv virtualenv 3.12 p3.12"
|
||||
|
||||
# Instalacja Pythona 3.12 z --enable-shared
|
||||
RUN env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 3.12.0
|
||||
# Set p3.12 as the default virtual environment
|
||||
RUN bash -i -c "source ~/.bashrc && pyenv local p3.12"
|
||||
|
||||
# Utworzenie środowiska wirtualnego p3.12
|
||||
RUN pyenv virtualenv 3.12.0 p3.12
|
||||
# Install ipython in the p3.12 environment
|
||||
RUN bash -i -c "source ~/.bashrc && pyenv activate p3.12 && pip install ipython"
|
||||
|
||||
# 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
|
||||
# Install Vim-Plug for Vim plugin management
|
||||
RUN curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
|
||||
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||||
|
||||
# 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
|
||||
# Copy the vim configuration file for plugins
|
||||
COPY ./_confs/.vimrc /home/user/.vimrc
|
||||
|
||||
# Instalacja wtyczek Vim za pomocą Vim-Plug
|
||||
# Install Vim plugins via Vim-Plug
|
||||
RUN vim +'PlugInstall --sync' +qall
|
||||
|
||||
# Instalacja Poetry w środowisku p3.12
|
||||
# Install Poetry
|
||||
RUN curl -sSL https://install.python-poetry.org | python3 -
|
||||
|
||||
# Kopiowanie projektu do obrazu
|
||||
# Copy the project into the image
|
||||
COPY --chown=user:user . /home/user/fapi
|
||||
COPY ./_confs/* ./
|
||||
|
||||
# Instalacja zależności za pomocą Poetry z głównego katalogu
|
||||
RUN cd /home/user/fapi && poetry config virtualenvs.create false && poetry install
|
||||
# Set the working directory for installing dependencies
|
||||
WORKDIR /home/user/fapi
|
||||
|
||||
# Uruchomienie aplikacji
|
||||
CMD ["python", "/home/user/fapi/entrypoint.py"]
|
||||
# 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"]
|
||||
|
||||
|
|
5
__n1
5
__n1
|
@ -1,7 +1,8 @@
|
|||
sudo docker run --rm \
|
||||
-dit \
|
||||
--privileged \
|
||||
-p 9999:9999 \
|
||||
-p 8888:8888 \
|
||||
-v /home/user/work/fapi/fapi/src:/home/user/fapi \
|
||||
--name f1 \
|
||||
-v $(pwd):/home/user/fapi\
|
||||
--name b1 \
|
||||
fapi bash
|
||||
|
|
2
__run2
2
__run2
|
@ -1 +1 @@
|
|||
docker run --rm -it -p 8888:8888 --name cfapi fapi bash
|
||||
docker run --rm -it -p 9999:9999 --name cfapi fapi bash
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
set-option -g prefix C-s
|
||||
set-option -g prefix C-e
|
||||
set -s set-clipboard on
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -4,7 +4,7 @@ from sqlalchemy.ext.declarative import declarative_base
|
|||
from sqlalchemy.orm import sessionmaker
|
||||
|
||||
#SQLALCHEMY_DATABASE_URL = "sqlite:///./test.db" # Dla SQLite
|
||||
SQLALCHEMY_DATABASE_URL = "mysql+mysqldb://root:secret@172.19.0.4:3306/test"
|
||||
SQLALCHEMY_DATABASE_URL = "mysql+mysqldb://root:secret@172.18.0.4:3306/test"
|
||||
|
||||
engine = create_engine(
|
||||
SQLALCHEMY_DATABASE_URL,
|
||||
|
|
Loading…
Reference in New Issue