add basic devcontainer setup#694
add basic devcontainer setup#694rababerladuseladim wants to merge 10 commits intoSuperCoopBerlin:masterfrom
Conversation
|
@Theophile-Madet could you review? |
…ation to make use of dockers caching, add non-root user
|
@rababerladuseladim I haven't used devcontainers yet. I'm getting an idea of it, but could you explain a bit more how to use it? |
problemRunning tapir locally looked quite cumbersome to me due to the system dependencies. The dev setup guidelines mention for example python 3.13 which might be different from the locally available python version on a dev machine, as well as a few system libraries that are required for the poetry install command to succeed. This might lead to cumbersome on-boarding of new devs or losing interested devs altogether. solutionAdd a devcontainer setup. This is automatically recognized by common IDEs (vscode, intellij family (e.g. pycharm), or github codespaces) and the IDE offers to set up the dev environment for you. In this PR, the docker-compose is executed and the IDE is run in the Does this answer your question? p.s. additional motivation comes from not having worked with devcontainers myself and really wanting to try it. |
Theophile-Madet
left a comment
There was a problem hiding this comment.
Hi,
Thanks for the pr 🙏
I tried using this with PyCharm, I think it needs adjustments. I'm guessing the problem is that the dev container uses the same compose environment as the dev server.
- Clone the repo in the fresh folder, checkout this PR
- Open the folder in the IDE: devcontainer gets suggested, docker compose gets started and the python packages from the inside the container get used by the IDE, that's great. I tried this from Windows where many packages are a pain to install, through the container it worked right away
- The docker containers are running but the command of the web container has been overridden (here), so the web server is not available.
- If I run
docker compose up -d, the web container gets recreated with the dev server command, so I can access the server, but the connection from the IDE to the dev container gets lost.
Using the same django.Dockerfile as base is good for consistency, but I don't think the docker-compose.yml should be used.
We'll also have to check how to handle the npm and vite: the files under src are tsx / React files, the dev container probably needs to have the npm packages installed for the IDE to provide support there too. That usually happens in the vite container from vite.Dockerfile. We may have to combine the two dockerfiles to make a full dev container.
|
Hey Theo, thank you for the review. I am not fully satisfied yet, either. Test currently do not pass because I did not yet manage to file access permissions working locally and in the CI on the same image. I hope to fix that soon. Regarding the dev environment for the vite container: my impression is that this repo contains two projects: one is the django container, the other the vite container. If that is the case, one way to separate this would be to separate that into dedicated project subfolders that each have their dedicated devcontainer. Maybe we can have a meeting / call to discuss that. What do you think? |
|
Hey, yes we can schedule a call, write me on slack or send me a mail, my contact is on my github profile. |
I added a dev container setup that should allow easy and reproducible development environment setup. If this is approved and merged, I can also update the setup instructions accordingly.