From 85cec9fbb94ed31b5840108666dc86a69310e388 Mon Sep 17 00:00:00 2001 From: Michael Plunkett <5885605+michplunkett@users.noreply.github.com> Date: Mon, 3 Mar 2025 08:10:23 -0600 Subject: [PATCH] Consolidate and organize config files (#61) --- .coveragerc | 3 --- docker-compose.yml | 4 ++-- web.Dockerfile => docker/web/Dockerfile | 8 ++++---- worker.Dockerfile => docker/worker/Dockerfile | 8 ++++---- pyproject.toml | 7 +++++++ pytest.ini | 2 -- 6 files changed, 17 insertions(+), 15 deletions(-) delete mode 100644 .coveragerc rename web.Dockerfile => docker/web/Dockerfile (76%) rename worker.Dockerfile => docker/worker/Dockerfile (86%) delete mode 100644 pytest.ini diff --git a/.coveragerc b/.coveragerc deleted file mode 100644 index f6cc4e8..0000000 --- a/.coveragerc +++ /dev/null @@ -1,3 +0,0 @@ -[run] -omit = - app/migrations/* diff --git a/docker-compose.yml b/docker-compose.yml index 737c346..635f7cd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,7 +7,7 @@ services: web: build: context: . - dockerfile: web.Dockerfile + dockerfile: docker/web/Dockerfile restart: always env_file: .env.prod environment: @@ -31,7 +31,7 @@ services: worker: build: context: . - dockerfile: worker.Dockerfile + dockerfile: docker/worker/Dockerfile restart: always env_file: .env.prod command: celery --app=app.worker.main.celery worker -Q high_priority,low_priority --concurrency=${CONCURRENCY} --max-tasks-per-child=100 diff --git a/web.Dockerfile b/docker/web/Dockerfile similarity index 76% rename from web.Dockerfile rename to docker/web/Dockerfile index d142877..cfd60d6 100644 --- a/web.Dockerfile +++ b/docker/web/Dockerfile @@ -10,13 +10,13 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ && rm -rf /var/lib/apt/lists/* RUN pip install --no-cache-dir poetry -COPY pyproject.toml poetry.lock README.md . +COPY ../../pyproject.toml ../../poetry.lock ../../README.md ./ RUN poetry install --with web --no-interaction --no-ansi --no-cache # Copy the application code and configurations -COPY alembic.ini ./ -COPY ./app/ ./app/ -COPY user-groups.* ./app/ +COPY ../../alembic.ini ./ +COPY ../../app ./app/ +COPY ../../user-groups.* ./app/ # Run the FastAPI app with Uvicorn ENTRYPOINT ["poetry", "run"] diff --git a/worker.Dockerfile b/docker/worker/Dockerfile similarity index 86% rename from worker.Dockerfile rename to docker/worker/Dockerfile index 9154c32..23c1e45 100644 --- a/worker.Dockerfile +++ b/docker/worker/Dockerfile @@ -20,14 +20,14 @@ RUN apt update -y && \ python3 -m venv ./poetry-venv && \ ./poetry-venv/bin/python -m pip install --upgrade pip && \ ./poetry-venv/bin/python -m pip install "poetry>=2.0.0,<3.0.0" -COPY pyproject.toml poetry.lock ./ +COPY ../../pyproject.toml ../../poetry.lock ./ RUN ./poetry-venv/bin/poetry install --without dev --no-root --no-cache # install dependencies # copy source code and .env files over -COPY alembic.ini ./ -COPY ./app/ ./app/ -COPY user-groups.* ./app/ +COPY ../../alembic.ini ./ +COPY ../../app ./app/ +COPY ../../user-groups.* ./app/ ENTRYPOINT ["./poetry-venv/bin/poetry", "run"] diff --git a/pyproject.toml b/pyproject.toml index df7b789..75f6e63 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,6 +31,13 @@ dependencies = [ "requests (>=2.25.1)", "pyopenssl (>=23.3.0)", ] + +[tool.pytest.ini_options] +pythonpath = "." + +[tool.coverage.run] +omit = ["app/migrations/*"] + [tool.poetry.group.worker.dependencies] watchdog = ">=6.0.0,<7.0.0" setuptools = "^75.8.0" diff --git a/pytest.ini b/pytest.ini deleted file mode 100644 index a635c5c..0000000 --- a/pytest.ini +++ /dev/null @@ -1,2 +0,0 @@ -[pytest] -pythonpath = .