Skip to content

Improve Docker configuration in the package #467

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jun 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
name: integration-tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
Expand All @@ -39,7 +39,7 @@ jobs:
name: pylint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
Expand All @@ -55,7 +55,7 @@ jobs:
name: mypy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
Expand Down
11 changes: 10 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ First of all, thank you for contributing to Meilisearch! The goal of this docume

### Setup <!-- omit in toc -->

You can set up your local environment natively or using `docker`, check out the [`docker-compose.yml`](/docker-compose.yml).

Example of running all the checks with docker:
```bash
docker-compose run --rm package bash -c "pipenv run mypy meilisearch && pipenv run pylint meilisearch && pipenv run pytest tests"
```

To install dependencies:

```bash
pipenv install --dev
```
Expand All @@ -40,7 +49,7 @@ Each PR should pass the tests, mypy type checking, and the linter to be accepted
# Tests
curl -L https://install.meilisearch.com | sh # download Meilisearch
./meilisearch --master-key=masterKey --no-analytics # run Meilisearch
pipenv run pytest meilisearch
pipenv run pytest tests
# MyPy
pipenv run mypy meilisearch
# Linter
Expand Down
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM python:3.8.4-buster

COPY Pipfile .
COPY Pipfile.lock .

RUN apt-get update -y

# Install pipenv and compilation dependencies
RUN pip3 install pipenv
RUN pipenv install --dev
24 changes: 24 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
version: "3.8"

services:
package:
build: .
tty: true
stdin_open: true
working_dir: /home/package
environment:
- MEILISEARCH_HOST=http://meilisearch:7700
depends_on:
- meilisearch
links:
- meilisearch
volumes:
- ./:/home/package

meilisearch:
image: getmeili/meilisearch:latest
ports:
- "7700"
environment:
- MEILI_MASTER_KEY=masterKey
- MEILI_NO_ANALYTICS=true
4 changes: 3 additions & 1 deletion tests/common.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import os

MASTER_KEY = 'masterKey'
BASE_URL = 'http://127.0.0.1:7700'
BASE_URL = os.getenv('MEILISEARCH_HOST') if os.getenv('MEILISEARCH_HOST') else 'http://127.0.0.1:7700'

INDEX_UID = 'indexUID'
INDEX_UID2 = 'indexUID2'
Expand Down