From 0d205ebd5e3ceafbd8a70eecb9c19724a48df56f Mon Sep 17 00:00:00 2001 From: "Waylon S. Walker" Date: Fri, 2 Jun 2023 15:52:12 -0500 Subject: [PATCH] add docker compose setup --- Dockerfile | 14 ++++++++++++ Dockerfile.dev | 57 ++++++++++++++++++++++++++++++++++++++++++++++ docker-compose.yml | 40 ++++++++++++++++++++++++++++++++ 3 files changed, 111 insertions(+) create mode 100644 Dockerfile create mode 100644 Dockerfile.dev create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..dcb1ecc --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +from python:3.10 + +# install python and psycopg2 +# RUN apt-get update && apt-get install -y python3 python3-pip +# RUN pip3 install hatch +WORKDIR /app +Copy pyproject.toml /app +COPY learn_sql_model/__about__.py /app/learn_sql_model/__about__.py +COPY README.md /app +RUN pip3 install . +COPY . /app +RUN pip3 install . + +ENTRYPOINT ["learn-sql-model", "api", "run"] diff --git a/Dockerfile.dev b/Dockerfile.dev new file mode 100644 index 0000000..3a4ead4 --- /dev/null +++ b/Dockerfile.dev @@ -0,0 +1,57 @@ +FROM learn-sql-model + +ENV DEBIAIN_FRONTEND=noninteractive +ENV PATH="$PATH:/root/.local/bin:/root/.cargo/bin" +ENV SHELL=zsh +ENV USER=root + + +RUN apt update && \ + apt upgrade -y && \ + apt install -y \ + bat \ + ripgrep \ + cmake \ + htop \ + stow \ + zsh + + +WORKDIR /root/downloads + +RUN wget https://github.com/neovim/neovim/releases/download/nightly/nvim.appimage && \ + mkdir -p /root/.local/bin && \ + chmod u+x /root/downloads/nvim.appimage && \ + /root/downloads/nvim.appimage --appimage-extract && \ + rm -rf nvim.appimage && \ + ln -s ~/downloads/squashfs-root/usr/bin/nvim ~/.local/bin/nvim && \ + cd ~ && \ + git clone https://github.com/LazyVim/starter ~/.config/nvim && \ + nvim --headless -c 'quitall' + +RUN curl -sS https://starship.rs/install.sh | sh -s -- -y +RUN curl -L zellij.dev/launch | sh -s -- help +# RUN curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly -y && \ +# cargo install \ +# exa \ +# gitui + +RUN python3 -m pip install --upgrade pip && \ + python3 -m pip install pipx && \ + python3 -m pip install hatch && \ + python3 -m pipx install ansible-core && \ + python3 -m pipx install lolcat && \ + python3 -m pipx install pyflyby && \ + python3 -m pipx install rich-cli && \ + python3 -m pipx install visidata + +WORKDIR /app + +COPY . . +RUN python3 -m hatch env create && \ + python3 -m hatch shell + + +RUN stow bin -t /root/ + +ENTRYPOINT /tmp/zellij/bootstrap/zellij diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..8cfeb24 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,40 @@ +version: "3.8" +services: + db: + image: postgres:14.1-alpine + restart: always + environment: + - POSTGRES_USER=postgres + - POSTGRES_PASSWORD=postgres + ports: + - "5432:5432" + volumes: + - db:/var/lib/postgresql/data + api: + build: + dockerfile: Dockerfile + tags: + - "learn-sql-model" + image: learn-sql-model + restart: always + ports: + - "5000:5000" + depends_on: + - db + volumes: + - ./:/app + cli: + build: + dockerfile: Dockerfile.dev + tags: + - "learn-sql-model-dev" + image: learn-sql-model-dev + depends_on: + - db + - api + restart: always + tty: true + stdin_open: true +volumes: + db: + driver: local