diff --git a/docker-bake.hcl b/docker-bake.hcl index 3bed9c2a0..24c3e9012 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -7,7 +7,7 @@ group "default" { } target "_base" { - dockerfile = "src/mock_vws/_flask_server/Dockerfile" + dockerfile = "server/Dockerfile" platforms = ["linux/amd64", "linux/arm64"] } diff --git a/docs/source/docker.rst b/docs/source/docker.rst index 4ca54910c..d8191f07d 100644 --- a/docs/source/docker.rst +++ b/docs/source/docker.rst @@ -110,9 +110,9 @@ Run each readiness probe until it exits successfully: .. code-block:: console - $ container exec vuforia-target-manager-mock python /app/src/mock_vws/_flask_server/healthcheck.py - $ container exec vuforia-vws-mock python /app/src/mock_vws/_flask_server/healthcheck.py - $ container exec vuforia-vwq-mock python /app/src/mock_vws/_flask_server/healthcheck.py + $ container exec vuforia-target-manager-mock python -m vws_mock_server.healthcheck + $ container exec vuforia-vws-mock python -m vws_mock_server.healthcheck + $ container exec vuforia-vwq-mock python -m vws_mock_server.healthcheck To stop and remove this deployment: @@ -134,7 +134,7 @@ To mimic this functionality, this mock provides a target manager container which To add a database, make a request to the following endpoint against the target manager container: -.. autoflask:: mock_vws._flask_server.target_manager:TARGET_MANAGER_FLASK_APP +.. autoflask:: vws_mock_server.target_manager:TARGET_MANAGER_FLASK_APP :endpoints: create_cloud_database For example, with either deployment above, use ``curl``: @@ -170,7 +170,7 @@ Deleting a database To delete a database use the following endpoint: -.. autoflask:: mock_vws._flask_server.target_manager:TARGET_MANAGER_FLASK_APP +.. autoflask:: vws_mock_server.target_manager:TARGET_MANAGER_FLASK_APP :endpoints: delete_cloud_database Setting the recognition counts of a target @@ -179,7 +179,7 @@ Setting the recognition counts of a target The mock does not count recognitions, because the counts which the real Vuforia Web Services report lag behind its queries by longer than a test runs. To make the target summary report and the reco counts report show non-zero counts, set the counts with the following endpoint: -.. autoflask:: mock_vws._flask_server.target_manager:TARGET_MANAGER_FLASK_APP +.. autoflask:: vws_mock_server.target_manager:TARGET_MANAGER_FLASK_APP :endpoints: set_target_recognition_counts @@ -281,7 +281,7 @@ These commands build the images with ``docker buildx``. .. code-block:: console $ export REPOSITORY_ROOT="$PWD" - $ export DOCKERFILE="$REPOSITORY_ROOT/src/mock_vws/_flask_server/Dockerfile" + $ export DOCKERFILE="$REPOSITORY_ROOT/server/Dockerfile" $ export TARGET_MANAGER_TAG=ghcr.io/vws-python/vuforia-target-manager-mock:latest $ export VWS_TAG=ghcr.io/vws-python/vuforia-vws-mock:latest diff --git a/pyproject.toml b/pyproject.toml index 01a74e63d..87ae7d20b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -374,8 +374,8 @@ ignore = [ "newsfragments/**", "prek.toml", "secrets.tar.gpg", + "server/Dockerfile", "spelling_private_dict.txt", - "src/mock_vws/_flask_server/Dockerfile", "styles/snapper/*.yml", "tests", "tests/**", diff --git a/src/mock_vws/_flask_server/Dockerfile b/server/Dockerfile similarity index 91% rename from src/mock_vws/_flask_server/Dockerfile rename to server/Dockerfile index e55fe4a7d..73a239312 100644 --- a/src/mock_vws/_flask_server/Dockerfile +++ b/server/Dockerfile @@ -30,12 +30,12 @@ HEALTHCHECK --interval=1s --timeout=10s --start-period=5s --retries=3 CMD ["pyth FROM base AS vws ENV VWS_HOST=0.0.0.0 -CMD ["src/mock_vws/_flask_server/vws.py"] +CMD ["-m", "vws_mock_server.vws"] FROM base AS vwq ENV VWQ_HOST=0.0.0.0 -CMD ["src/mock_vws/_flask_server/vwq.py"] +CMD ["-m", "vws_mock_server.vwq"] FROM base AS target-manager ENV TARGET_MANAGER_HOST=0.0.0.0 -CMD ["src/mock_vws/_flask_server/target_manager.py"] +CMD ["-m", "vws_mock_server.target_manager"] diff --git a/tests/mock_vws/test_docker.py b/tests/mock_vws/test_docker.py index c9bea86e2..1c1a6968b 100644 --- a/tests/mock_vws/test_docker.py +++ b/tests/mock_vws/test_docker.py @@ -321,7 +321,7 @@ def _build_image( The built image. """ client = docker.from_env() - dockerfile = f"{repository_root}/src/mock_vws/_flask_server/Dockerfile" + dockerfile = f"{repository_root}/server/Dockerfile" try: image, _ = client.images.build( path=repository_root,