-
Notifications
You must be signed in to change notification settings - Fork 318
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
Added Dev Container support #474
Added Dev Container support #474
Conversation
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.
Thanks, seems to work fine. New files should be added to .dockerignore
.
"forwardPorts": [8000], | ||
|
||
// Use 'postCreateCommand' to run commands after the container is created. | ||
"postCreateCommand": "pip3 install --user -r requirements.txt && npm install && mkdir -p data && python3 manage.py migrate", |
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.
linkding also has a few integration tests using Playwright. Playwright needs to additionally download a browser, currently I'm using playwright install chromium
in Github Actions. Doing that in the dev container works, but then the tests fail:
python manage.py test
...
╔══════════════════════════════════════════════════════╗
║ Host system is missing dependencies to run browsers. ║
║ Missing libraries: ║
║ libatk-1.0.so.0 ║
║ libatk-bridge-2.0.so.0 ║
║ libcups.so.2 ║
║ libdbus-1.so.3 ║
║ libatspi.so.0 ║
║ libXcomposite.so.1 ║
║ libXdamage.so.1 ║
║ libXfixes.so.3 ║
║ libXrandr.so.2 ║
║ libgbm.so.1 ║
║ libdrm.so.2 ║
║ libxkbcommon.so.0 ║
║ libpango-1.0.so.0 ║
║ libcairo.so.2 ║
║ libasound.so.2 ║
╚══════════════════════════════════════════════════════╝
Not a blocker, the integration test setup currently also has other issues like needing to run certain commands beforehand. But maybe something to look into in the future.
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.
I have added "playwright install chromium && playwright install-deps" to the post create script. The tests run now, however there were 2 failures and 1 error. I don't know whether those are existing problems or whether they are to do with running in the dev container.
If there are other commands that need to be run prior to the tests let me know and I can try adding them in. If post create isn't appropriate there are also some other hooks where scripts can be run.
.devcontainer/devcontainer.json
Outdated
"forwardPorts": [8000], | ||
|
||
// Use 'postCreateCommand' to run commands after the container is created. | ||
"postCreateCommand": "pip3 install --user -r requirements.txt && npm install && mkdir -p data && python3 manage.py migrate && playwright install chromium && playwright install-deps", |
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.
playwright install-deps
failed for me:
E: Package 'ttf-ubuntu-font-family' has no installation candidate
E: Unable to locate package libenchant1c2a
E: Unable to locate package libicu66
E: Package 'libjpeg-turbo8' has no installation candidate
Failed to install browser dependencies
Error: Installation process exited with code: 100
[120273 ms] postCreateCommand failed with exit code 1. Skipping any further user-provided commands.
Let's remove the playwright installation for now, I'll figure out how to run the playwright tests separately at some point.
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.
Interesting, I wonder why the command works for me and not for you, that shouldn't happen. If it becomes a problem we can use a base Dockerfile for the Dev Container rather then the Microsoft Python Container, that way it can be pre-setup with all dependencies that are required.
For now I have removed the playwright commands. Let me know if there are any other changes required,
For #473
This adds the necessary files to support developing with Dev Containers. It should have no impact on anyone who chooses to develop without Dev Containers, it simply adds it as an option.
The changes:
If you have any questions on how this works let me know and I can add further detail. I'd be happy to more detail to the documentation around this.