-
Notifications
You must be signed in to change notification settings - Fork 5
initial docker config #29
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
Changes from 3 commits
a6f747c
408264a
4944a01
06d8cc0
adcdbb9
a284f1d
c8a83c6
dfc71b2
7e6b549
59ae145
d54f231
08c3681
6a1d640
6b80921
4823d80
cc5b693
a4376af
e44fc23
347d18d
cf52eaf
d278836
2c09994
9e4cf0f
b899cc1
79e9970
47c1cb6
c9c6e1c
309067f
2f157ac
0536e14
3b27017
c0c9f5c
e51c58b
cd577b9
cbf0f4e
02e0802
0dd63d2
ed4b758
561e54e
4580043
432d2ba
5b1a4c4
57a9f7a
d5e493a
2d54a91
3a9706c
25f12da
472160a
666c68f
60924a8
0ff1aed
77701f2
b50a53a
356b1c6
b7773c4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| version: "3.9" | ||
|
|
||
| services: | ||
| redis: | ||
| image: redis:7-alpine | ||
| container_name: redis | ||
| ports: | ||
| - "6379:6379" | ||
| volumes: | ||
| - redis_data:/data | ||
| restart: unless-stopped | ||
|
|
||
| rabbitmq: | ||
| image: rabbitmq:3-management | ||
| container_name: rabbitmq | ||
| ports: | ||
| - "5672:5672" # RabbitMQ main port | ||
| - "15672:15672" # RabbitMQ management UI | ||
| volumes: | ||
| - rabbitmq_data:/var/lib/rabbitmq | ||
| environment: | ||
| RABBITMQ_DEFAULT_USER: guest | ||
| RABBITMQ_DEFAULT_PASS: guest | ||
| restart: unless-stopped | ||
|
||
| healthcheck: | ||
| test: ["CMD", "rabbitmq-diagnostics", "ping"] | ||
| interval: 30s | ||
| timeout: 10s | ||
| retries: 5 | ||
|
|
||
| ollama: | ||
| image: ollama/ollama:latest | ||
| container_name: ollama | ||
| ports: | ||
| - "11434:11434" | ||
| volumes: | ||
| - ollama_data:/root/.ollama | ||
| restart: unless-stopped | ||
| # Optional: Uncomment below to disable if not needed | ||
| # deploy: | ||
| # replicas: 0 | ||
|
|
||
| api_server: | ||
| build: | ||
| context: . | ||
| dockerfile: docker/api_server.dockerfile | ||
| container_name: api_server | ||
| depends_on: | ||
| rabbitmq: | ||
| condition: service_healthy | ||
| redis: | ||
| condition: service_started | ||
| ports: | ||
| - "8000:8000" | ||
| environment: | ||
| - REDIS_URL=redis://redis:6379/0 | ||
| - RABBITMQ_URL=amqp://guest:guest@rabbitmq:5672/ | ||
|
||
| - OLLAMA_URL=http://ollama:11434 | ||
| volumes: | ||
| - .:/app | ||
|
||
| command: ["poetry", "run", "python", "run_api.py"] | ||
|
|
||
| worker: | ||
| build: | ||
| context: . | ||
| dockerfile: docker/worker.dockerfile | ||
| container_name: worker | ||
| depends_on: | ||
| rabbitmq: | ||
| condition: service_healthy | ||
| redis: | ||
| condition: service_started | ||
| environment: | ||
| - REDIS_URL=redis://redis:6379/0 | ||
| - RABBITMQ_URL=amqp://guest:guest@rabbitmq:5672/ | ||
| - OLLAMA_URL=http://ollama:11434 | ||
| volumes: | ||
| - .:/app | ||
|
||
| command: ["poetry", "run", "dramatiq", "mxtoai.tasks", "--watch", "./."] | ||
|
|
||
| volumes: | ||
| rabbitmq_data: | ||
| ollama_data: | ||
| redis_data: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| # docker/api_server.Dockerfile | ||
|
|
||
| FROM python:3.13-slim-bookworm | ||
|
|
||
| # System deps | ||
| RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
| curl \ | ||
| build-essential \ | ||
| ffmpeg \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| # Set workdir | ||
| WORKDIR /app | ||
|
|
||
| # Install Poetry | ||
| ENV POETRY_VERSION=2.1.3 | ||
|
||
| RUN curl -sSL https://install.python-poetry.org | python3 - && \ | ||
| ln -s /root/.local/bin/poetry /usr/local/bin/poetry | ||
|
|
||
| # Copy only dependency files to leverage Docker cache | ||
| COPY pyproject.toml poetry.lock ./ | ||
|
|
||
| # Install dependencies (no venv) | ||
| RUN poetry config virtualenvs.create false && poetry install --no-root --no-interaction --no-ansi | ||
|
|
||
| # Copy the rest of the application | ||
| COPY . . | ||
|
||
|
|
||
| # Expose API port (change as needed) | ||
| EXPOSE 8000 | ||
|
||
|
|
||
| # Run the API | ||
| CMD ["poetry", "run", "python", "run_api.py"] | ||
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| # docker/worker.Dockerfile | ||
|
|
||
| FROM python:3.13-slim-bookworm | ||
|
|
||
| # System deps | ||
| RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
| curl \ | ||
| build-essential \ | ||
| ffmpeg \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| # Set workdir | ||
| WORKDIR /app | ||
|
|
||
| # Install Poetry | ||
| ENV POETRY_VERSION=2.1.3 | ||
|
||
| RUN curl -sSL https://install.python-poetry.org | python3 - && \ | ||
| ln -s /root/.local/bin/poetry /usr/local/bin/poetry | ||
|
|
||
| # Copy only dependency files | ||
| COPY pyproject.toml poetry.lock ./ | ||
|
|
||
| # Install dependencies | ||
| RUN poetry config virtualenvs.create false && poetry install --no-root --no-interaction --no-ansi | ||
|
|
||
| # Copy rest of the worker code | ||
| COPY . . | ||
|
||
|
|
||
| # Run Dramatiq worker (entrypoint can be adjusted) | ||
| CMD ["poetry", "run", "dramatiq", "mxtoai.tasks", "--watch", "./."] | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's add auth, env variable for REDIS_PASSWORD or something