Skip to content

Add devcontainer flag #9758

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 1 commit into from
Jun 11, 2025
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
1 change: 1 addition & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ services:
INVENTREE_SITE_URL: http://localhost:8000
INVENTREE_CORS_ORIGIN_ALLOW_ALL: True
INVENTREE_PY_ENV: /home/inventree/dev/venv
INVENTREE_DEVCONTAINER: True

depends_on:
- db
7 changes: 6 additions & 1 deletion tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ def is_true(x):
return str(x).strip().lower() in ['1', 'y', 'yes', 't', 'true', 'on']


def is_devcontainer_environment():
"""Check if the InvenTree environment is running in a development container."""
return is_true(os.environ.get('INVENTREE_DEVCONTAINER', 'False'))


def is_docker_environment():
"""Check if the InvenTree environment is running in a Docker container."""
return is_true(os.environ.get('INVENTREE_DOCKER', 'False'))
Expand Down Expand Up @@ -217,7 +222,7 @@ def envcheck_invoke_cmd():
intendded = ['/bin/invoke', '/bin/inv']

correct_cmd: Optional[str] = None
if is_rtd_environment() or is_docker_environment():
if is_rtd_environment() or is_docker_environment() or is_devcontainer_environment():
pass
elif is_pkg_installer(load_content=True) and not is_pkg_installer_by_path():
correct_cmd = 'inventree run invoke'
Expand Down
Loading