diff --git a/demo/demo.py b/demo/demo.py index b637af39..01ee1bfe 100644 --- a/demo/demo.py +++ b/demo/demo.py @@ -6,7 +6,6 @@ import typer from pydantic import SecretStr -from demo.settings import OverhaveDemoAppLanguage, OverhaveDemoSettingsGenerator from overhave import ( OverhaveAdminContext, OverhavePublicationContext, @@ -24,6 +23,8 @@ from overhave.cli.synchronizer import _create_synchronizer, _create_validator from overhave.scenario.parser.parser import BaseScenarioParserError +from .settings import OverhaveDemoAppLanguage, OverhaveDemoSettingsGenerator + logger = logging.getLogger(__name__) overhave_demo = typer.Typer(context_settings={"help_option_names": ["-h", "--help"]}) diff --git a/docker-compose.yml b/docker-compose.yml index 73409e0f..568c3a7c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -52,3 +52,19 @@ services: environment: - PYPI_TOKEN=${PYPI_TOKEN:-unset} - VENV=${VENV:-.tox/.package} + + demo: + ports: + - 8076:8076 + build: + context: . + dockerfile: docker/Dockerfile.demo + network: host + environment: + - OVERHAVE_DB_URL=${OVERHAVE_DB_URL:-postgresql://postgres:postgres@db/postgres} + - OVERHAVE_REDIS_URL=${OVERHAVE_REDIS_URL:-redis://redis:6379} + - OVERHAVE_REDIS_SENTINEL_URLS=${OVERHAVE_REDIS_SENTINEL_URLS:-["redis://redis:6379"]} + - PACKAGE_BUILD_DIR=${PACKAGE_BUILD_DIR:-.package/dist} + depends_on: + - db + - redis diff --git a/docker/Dockerfile.demo b/docker/Dockerfile.demo new file mode 100644 index 00000000..d81aac2a --- /dev/null +++ b/docker/Dockerfile.demo @@ -0,0 +1,34 @@ +FROM python:3.11-slim + +ENV PIP_DISABLE_PIP_VERSION_CHECK=on +ENV PIP_NO_CACHE_DIR=off + +WORKDIR /code + +RUN apt-get update -o Acquire::Check-Valid-Until=false \ + && apt-get install -y --no-install-recommends \ + gcc \ + libsasl2-dev \ + libldap2-dev \ + libssl-dev \ + libpq-dev \ + make \ + g++ \ + libgnutls28-dev \ + git \ + && rm -rf /var/lib/apt/lists/* + +ARG POETRYCACHEDIR=/tmp/.cache/pypoetry + +COPY . /code/ +COPY poetry.lock pyproject.toml /code/ + +RUN pip install --no-compile --upgrade pip \ + && pip install --no-compile poetry +RUN poetry config virtualenvs.create false \ + && poetry config cache-dir ${POETRYCACHEDIR} \ + && poetry install --no-interaction --no-ansi + +ENV PYTHONPATH "/code" + +CMD poetry run overhave db create-all && poetry run overhave-demo admin --host 0.0.0.0 \ No newline at end of file