-
-
Notifications
You must be signed in to change notification settings - Fork 344
Dev container #214
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
base: main
Are you sure you want to change the base?
Dev container #214
Conversation
This enables docker based devcontainers that contain all developmentation dependencies and is configured using code. Which allows to fast develop new features or plugins without requiring any hardware. For different host operating systems and mocks the display refresh. Display refresh would in theory also work but currently has issues with the rendering not happening on the main thread.
|
Thanks for the PR! I've been wanting to work on this but haven't had much of an opportunity so far. Some thoughts:
|
|
I have added a readme feel free to test this out. @fatihak I'm referring to this change in line 68 where the In the devcontainer setup the hardware is not there thus To answer your questions: For this change I did not want to dive into thread logic thus a simple workaround was chosen. |
|
I was trying to create a similar dev environment but this seems to be a better approach it would be nice to be able to use the mock display but it at least allows development outside of the physical hardware. I was able to get it working on Linux but not on Windows are there host dependancies for display output?
|
Generates thumbnails and store files in cache for faster load times Cleanup on image delete
Create folder on plugin init Set gitignore automatically if not exists Set gallery and thumbnails folder as constant Remove redundant checks, folders should exist after init
|
@Ifouldm Thanks for testing this out on Linux. Can you check if the Might be related to this: microsoft/vscode-remote-release#7565 but now I'm just guessing :D |
|
I was considering trying to dockerize this project before I came across this PR. My goal would be to run this in a Container, stub in a display device that does HTTP Posts to an ESP32 based e-ink Spectra 6 (GoodDisplay Wifi devkit)... @doofmars I tried to get this going with a clean checkout of your branch using VS Code (NixOS Linux host), it prompted me to reopen then built a docker container, there were several errors towards the end (see 2nd log below) before post-install failed because there was no Log 1: Configuring... Terminal OutputRunning the postCreateCommand from devcontainer.json... [85049 ms] Start: Run in container: /bin/sh -c sh .devcontainer/post-create.sh Log 2: Dev Containers Terminal Output[57 ms] Dev Containers 0.427.0 in VS Code 1.105.1 (7d842fb85a0275a4a8e4d7e040d2625abbf7f084). Server: 1 warning found (use docker --debug to expand):
[71903 ms] Exit code 128
[84811 ms] Server bound to 127.0.0.1:42935 (IPv4) [84811 ms] Start: Run in container: echo 42935 >'/home/vscode/.vscode-server/data/Machine/.devport-7d842fb85a0275a4a8e4d7e040d2625abbf7f084' [84858 ms] [22:31:22] Installing extensions... [85049 ms] Start: Run in container: /bin/sh -c sh .devcontainer/post-create.sh |
|
Some progress... quick notes:
sudo pip install -r install/requirements.txt
sudo SRC_DIR=$(pwd)/src /usr/local/bin/python src/inkypi.py -s --type impressions
.devcontainer/linux-host/devcontainer.json patchdiff --git a/.devcontainer/linux-host/devcontainer.json b/.devcontainer/linux-host/devcontainer.json
index 132e78d..b324862 100644
--- a/.devcontainer/linux-host/devcontainer.json
+++ b/.devcontainer/linux-host/devcontainer.json
@@ -2,20 +2,34 @@
// README at: https://github.com/devcontainers/templates/tree/main/src/python
{
"name": "Linux Host - Python 3",
- "build": { "dockerfile": "../Dockerfile" },
+ "build": {
+ "dockerfile": "../Dockerfile",
+ "args": {
+ "USER_UID": "1000",
+ "USER_GID": "1000"
+ }
+ },
"postCreateCommand": "sh .devcontainer/post-create.sh",
-
+
"containerEnv": {
"SRC_DIR": "/workspaces/InkyPi/src",
- "DISPLAY": "${localEnv:DISPLAY}"
+ "DISPLAY": "${localEnv:DISPLAY}",
+ "WAYLAND_DISPLAY": "${localEnv:WAYLAND_DISPLAY}",
+ "XDG_RUNTIME_DIR": "/run/user/1000"
},
- // You might have to enable window redirect on your host using the command: `xhost +`
-
"mounts": [
- "source=/tmp/.X11-unix,target=/tmp/.X11-unix,type=bind"
+ "source=/tmp/.X11-unix,target=/tmp/.X11-unix,type=bind",
+ "source=/run/user/1000,target=/run/user/1000,type=bind"
],
+ "runArgs": [
+ "--user=1000:1000",
+ "--network=host"
+ ],
+
+ "remoteUser": "vscode",
+
// add vscode settings
"customizations": {
"vscode": {
@@ -28,8 +42,7 @@
"python.testing.promptToConfigure": false
}
}
- },
-
+ }
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {}, |
The .devcontainer/post-create.sh should handle the config file creation during setup. While I worked on this change I ran into the dilemma of the display binding and overall architecture. This is fine if you develop on real hardware but not if you want to virtualize everything.
Might have been missed in the post-create file, I had some issues with chrome-headless-shell on my end but I did not need this feature. |
|
Posted my devbox PR (and 4 other PRs) ... It kind of solves this problem without the devcontainer using Nix packages in the background. I'd say the only remaining benefit to using a devcontainer (which devbox can make via |
This is a setup for local devcontainer setup using vscode and docker.
The benefit is that the setup will take care of creating the environment and dependencies required for running the project.
On the host beside the editor and docker every other development dependency is contained in the container.
To display the image the inky library provides a mocked interface that would generate a window to simulate the display.
Currently as the refresh is not happening in the main thread this feature is mocked away, no preview is used.
Still the current image and log output can be used to estimate what is happening.
I'm raising this PR open for discussion @fatihak not sure how you deveop new features I like having a docker setup to encapsulate the dev-dependencies.
See this as a suggestion, if you have further questions feel free to ask.