Skip to content

Commit

Permalink
Merge pull request #33 from Kost0ne/feature/demo_docker
Browse files Browse the repository at this point in the history
Демонстрационный контейнер
  • Loading branch information
artamaney authored Jan 3, 2024
2 parents ddc37b6 + f51ba72 commit b8d09c4
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 1 deletion.
3 changes: 2 additions & 1 deletion demo/demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import typer
from pydantic import SecretStr

from demo.settings import OverhaveDemoAppLanguage, OverhaveDemoSettingsGenerator
from overhave import (
OverhaveAdminContext,
OverhavePublicationContext,
Expand All @@ -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"]})
Expand Down
16 changes: 16 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
34 changes: 34 additions & 0 deletions docker/Dockerfile.demo
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit b8d09c4

Please sign in to comment.