Skip to content

Add a devcontainer definition #3343

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

Draft
wants to merge 6 commits into
base: cleanup/tox-default-django
Choose a base branch
from

Conversation

lunkwill42
Copy link
Member

This adds a devcontainer definition for NAV development.

The top-level docker-compose.yml configuration that we've had for quite a while is somewhat brittle, and integrates poorly into most IDEs, whereas devcontainers should integrate well into both VSCode and PyCharm (and command line tools exist for those who insist on using more old school editors as well).

The hope is that this eventually can help every developer to obtain a more reproducible development environment for NAV.

The devcontainer definition is not yet fully complete (it still lacks a service definition for Graphite), so I'm leaving it in draft mode in the hopes that I can get some feedback on the work thus far.

This uses a base devcontainer image for Python code and adds some
specializations for NAV.

It also opts to add `uv` for Python environment management inside
the devcontainer.
This defines the NAV devcontainer and PostgreSQL as separate
services.
This tries to define an initial devcontainer for NAV development.  This
works for setting up and running NAV backend and front-end in the
same container, but at the moment it leaves out Graphite.
@lunkwill42 lunkwill42 added the nonews No news fragment is necessary for this PR (e.g. refactoring, cleanups, workflow/development changes) label Apr 22, 2025
@lunkwill42 lunkwill42 self-assigned this Apr 22, 2025
Copy link

github-actions bot commented Apr 22, 2025

🦙 MegaLinter status: ✅ SUCCESS

Descriptor Linter Files Fixed Errors Warnings Elapsed time

See detailed report in MegaLinter reports
Set VALIDATE_ALL_CODEBASE: true in mega-linter.yml to validate all sources, not only the diff

MegaLinter is graciously provided by OX Security

Copy link

github-actions bot commented Apr 22, 2025

Test results

   12 files     12 suites   12m 3s ⏱️
2 176 tests 2 176 ✅ 0 💤 0 ❌
6 003 runs  6 003 ✅ 0 💤 0 ❌

Results for commit d967e47.

♻️ This comment has been updated with latest results.

@lunkwill42
Copy link
Member Author

With PyCharm, I am having the issue described in https://youtrack.jetbrains.com/issue/IJPL-174150 (I've voted for this issue to be fixed). I.e. every time I connect PyCharm to the devcontainer, I have to select a Python interpreter for the project to work (I want /home/vscode/.venv/bin/python every time).

This script runs as the vscode user, not as root.  Instead of trying
to create a global upload dir where only root has access, this makes
the upload directory in the main virtualenv and reconfigures the
main `nav.conf` to point to that.
This lock file is produced by uv inside the devcontainer, but we don't
(currently) want that file to be committed to git.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
nonews No news fragment is necessary for this PR (e.g. refactoring, cleanups, workflow/development changes)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant