4 ms·
Yes, you are exactly right. I mentioned it further down, but my team and I are having preliminary success by integrating with VSCode's "Remote: Docker" extens
by sebastos 7y ago
Yes, you are exactly right.
I mentioned it further down, but my team and I are having preliminary success by integrating with VSCode's "Remote: Docker" extension. They've got it rigged so that all language support can run as remote servers inside the container. They give you a special .json file to control how you'd like to start the image, and you can supply a project-specific dockerfile that takes any additional IDE-specific steps that you want to add in as layers when opening up the project's dev container.
It still has some rough edges - for some reason, you can't supply Build-time arguments to the devcontainer Dockerfile I mentioned above, which makes it hard to get permissions to be non-annoying if you're worried your users will have odd UIDs. And there are a couple other random ticky tack things. But it's by far the closest to actually "developing out of a container" as you and I are imagining it, with all of the attendant benefits. When you want a new dev to start working on the project, they basically do this:
1. git clone newproject
2. Open that project in vscode
3. Respond to a pop-up that yes, I do want to open this in a container
4. <wait for the dev-specific layers to be built>
5. Do a normal project build
6. Enjoy full intellisense, syntax highlighting, import resolution, etc. in exactly the environment that's going to run.
In addition, by including the Dockerfile that builds the base image (the one that the dev container FROM's) into the source, developers can now change library versions and dependencies as a git commit, and then coerce other developers into automatically updating their environments by pushing a new image with a new tag to your gitlab / w/e, and then updating the tag mentioned in the FROM in your .devcontainer/Dockerfile. It's like how you would expect development to feel in 2020.
- hcrisp 7y agoI just figured out a similar workflow using PyCharm Pro. I set up a Deployment mapping from my Windows laptop to my Linux workstation which deploys code whenever I save. Then the Linux folder is volume-mounted into the Docker container. I set up a Remote Debugging configuration, and then after the Docker container is brought up, it will attach via SSH to the Python instance running in the remote Docker container. (Your code needs only have the pydevd_pycharm library installed.) From there you can breakpoint, watch variables, interact at the console, etc. It was a bit of bear to set up, but now I find it very tractable to run and immensely useful.