From a2a34eadfdc9c2a0765b1b71f2a7baf089b55fc5 Mon Sep 17 00:00:00 2001 From: Strift Date: Wed, 14 Oct 2026 10:21:11 +0800 Subject: [PATCH] Use a slim dev image and store dependencies in a Docker volume --- .dockerignore | 3 +++ CONTRIBUTING.md | 2 +- docker-compose.yml | 17 ++++++++++++----- Dockerfile => docker/python.Dockerfile | 6 +----- 4 files changed, 17 insertions(+), 11 deletions(-) create mode 100644 .dockerignore rename Dockerfile => docker/python.Dockerfile (51%) diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..4fb4f134 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +* +!docker/ +!docker/python.Dockerfile diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0ecbdeb8..ed5cbca8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -44,7 +44,7 @@ You can set up your local environment natively or using `docker`, check out the Example of running all the checks with docker: ```bash -docker-compose run --rm package bash -c "uv run mypy meilisearch && uv run ruff check && uv run ruff format --check && uv run pytest tests" +docker compose run --rm package bash -c "uv sync && uv run mypy meilisearch && uv run ruff check && uv run ruff format --check && uv run pytest tests" ``` To install dependencies: diff --git a/docker-compose.yml b/docker-compose.yml index 1f9f9630..93f3854b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,9 @@ services: package: - build: . + build: + context: . + dockerfile: docker/python.Dockerfile + image: meilisearch-python-dev tty: true stdin_open: true working_dir: /home/package @@ -8,15 +11,19 @@ services: - MEILISEARCH_URL=http://meilisearch:7700 depends_on: - meilisearch - links: - - meilisearch volumes: - ./:/home/package + # Hide the host virtualenv. Native wheels stay in this volume. + - package_venv:/home/package/.venv meilisearch: - image: getmeili/meilisearch-enterprise:latest + image: getmeili/meilisearch-enterprise:v1.55 ports: - - "7700" + - "7700:7700" environment: - MEILI_MASTER_KEY=masterKey - MEILI_NO_ANALYTICS=true + - MEILI_EXPERIMENTAL_ALLOWED_IP_NETWORKS=any + +volumes: + package_venv: diff --git a/Dockerfile b/docker/python.Dockerfile similarity index 51% rename from Dockerfile rename to docker/python.Dockerfile index 04dd3b2a..02938f0e 100644 --- a/Dockerfile +++ b/docker/python.Dockerfile @@ -4,8 +4,4 @@ COPY --from=ghcr.io/astral-sh/uv:0.11.19 /uv /uvx /bin/ WORKDIR /home/package -COPY pyproject.toml . -COPY uv.lock . - -# Install dependencies -RUN uv sync --frozen --no-install-project +CMD ["bash"]