Skip to content
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

🚀 feat: add docker-compose support #301

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
10 changes: 8 additions & 2 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@

# BACKEND configuration
BACKEND_ALLOW_ORIGINS=http://localhost:3000,http://127.0.0.1:3000
BACKEND_HOST=localhost
BACKEND_PORT=8000
BACKEND_RELOAD=True

# FRONTEND configuration
FRONTEND_HOST=0.0.0.0
FRONTEND_PORT=3000

TEXT_FILE_ENCODINGS=utf-8,latin1,cp1252,iso-8859-1
# Host port mapping for docker-compose (if not set, defaults are used in docker-compose.yml)
FRONTEND_HOST_PORT=3031
BACKEND_HOST_PORT=8081

# Supported text file encodings
TEXT_FILE_ENCODINGS=utf-8,latin1,cp1252,iso-8859-1
30 changes: 30 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
version: "3.9"

services:
docetl:
build: .
image: docetl
ports:
# Map host ports to container ports using environment variables.
# If FRONTEND_HOST_PORT is not set, default to 3031.
- "${FRONTEND_HOST_PORT:-3031}:3000"
# If BACKEND_HOST_PORT is not set, default to 8081.
- "${BACKEND_HOST_PORT:-8081}:8000"
environment:
# Pass environment variables from the .env file (or host environment)
# with default values if they are not defined.
- OPENAI_API_KEY=${OPENAI_API_KEY:-your_api_key_here}
- BACKEND_ALLOW_ORIGINS=${BACKEND_ALLOW_ORIGINS:-http://localhost:3000,http://127.0.0.1:3000}
- BACKEND_HOST=${BACKEND_HOST:-0.0.0.0}
- BACKEND_PORT=${BACKEND_PORT:-8000}
- BACKEND_RELOAD=${BACKEND_RELOAD:-True}
- FRONTEND_HOST=${FRONTEND_HOST:-0.0.0.0}
- FRONTEND_PORT=${FRONTEND_PORT:-3000}
- TEXT_FILE_ENCODINGS=${TEXT_FILE_ENCODINGS:-utf-8,latin1,cp1252,iso-8859-1}
volumes:
# Mount the named volume "docetl-data" to /docetl-data in the container.
- docetl-data:/docetl-data

volumes:
# Define a named volume for persistent data.
docetl-data: