From dc4d9e9f65de16d2aea1a0044b6f34f721929801 Mon Sep 17 00:00:00 2001 From: iskanred Date: Tue, 30 Apr 2024 00:23:49 +0300 Subject: [PATCH] add docker --- .dockerignore | 11 +++++++++++ Dockerfile-backend | 25 +++++++++++++++++++++++++ Dockerfile-frontend | 25 +++++++++++++++++++++++++ docker-compose.yaml | 15 +++++++++++++++ 4 files changed, 76 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile-backend create mode 100644 Dockerfile-frontend create mode 100644 docker-compose.yaml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..e8605cf --- /dev/null +++ b/.dockerignore @@ -0,0 +1,11 @@ +.github +.pytest_cache/ +reports/ +tests/ +*.coverage +setenv.bash +Dockerfile* +Makefile +*.md +*.pdf +.*ignore diff --git a/Dockerfile-backend b/Dockerfile-backend new file mode 100644 index 0000000..63cec85 --- /dev/null +++ b/Dockerfile-backend @@ -0,0 +1,25 @@ +FROM python:3.11 + +# Configure Poetry +ENV POETRY_VERSION=1.7.1 +ENV POETRY_HOME=/opt/poetry +ENV POETRY_VENV=/opt/poetry-venv +ENV POETRY_CACHE_DIR=/opt/.cache + +# Install poetry separated from system interpreter +RUN python3 -m venv $POETRY_VENV \ + && $POETRY_VENV/bin/pip install -U pip setuptools \ + && $POETRY_VENV/bin/pip install poetry==${POETRY_VERSION} + +# Add `poetry` to PATH +ENV PATH="${PATH}:${POETRY_VENV}/bin" + +WORKDIR /app + +# Install dependencies +COPY poetry.lock pyproject.toml ./ +RUN poetry install + +# Run your app +COPY . /app +CMD [ "poetry", "run", "bin/main.py"] diff --git a/Dockerfile-frontend b/Dockerfile-frontend new file mode 100644 index 0000000..913c398 --- /dev/null +++ b/Dockerfile-frontend @@ -0,0 +1,25 @@ +FROM python:3.11 + +# Configure Poetry +ENV POETRY_VERSION=1.7.1 +ENV POETRY_HOME=/opt/poetry +ENV POETRY_VENV=/opt/poetry-venv +ENV POETRY_CACHE_DIR=/opt/.cache + +# Install poetry separated from system interpreter +RUN python3 -m venv $POETRY_VENV \ + && $POETRY_VENV/bin/pip install -U pip setuptools \ + && $POETRY_VENV/bin/pip install poetry==${POETRY_VERSION} + +# Add `poetry` to PATH +ENV PATH="${PATH}:${POETRY_VENV}/bin" + +WORKDIR /app + +# Install dependencies +COPY poetry.lock pyproject.toml ./ +RUN poetry install + +# Run your app +COPY . /app +CMD [ "poetry", "run", "streamlit", "run", "ui/app.py" ] diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..293dfad --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,15 @@ +version: "3.8" + +services: + backend: + image: iskanred/jago_rebt_backend:1.0.0 + container_name: backend + ports: + - "8001:8001" + volumes: + - "./data:/app/data" + frontend: + image: iskanred/jago_rebt_frontend:1.0.0 + container_name: frontend + ports: + - "8501:8501"