-
Notifications
You must be signed in to change notification settings - Fork 1.4k
python-3 container template's Dockerfile unnecessarily refers to requirements.txt.temp #67
Comments
The goal is to actually install your requirements from the root folder @qubitron This was also mentioned by @kmehant in #66, so it seems to be creating some confusion... though I don't think there's actually anything functionally wrong. Now that we have What do you think? |
@Chuxel would a postCreateCommand run every time the container is created? That seems like a good solution since this is a bit of a hack to work around limitations in the Dockerfile. |
@qubitron Yep - Its intended for things like this and We could probably do |
The What I still don't understand is what the The reason I'm asking is I'm preparing some instructions for launching a module in Lest I come across as a whiner: Thanks for the remote-dev / dev-container functionality - it is an awesome feature for dev! |
@Chuxel the problem is that the workspace mount isn't available during build time, so there's still the problem of needing to copy in the requirements.txt file in a way that doesn't fail the build if it's not there @songololo with the COPY command the the docker build will fail if the requirements.txt file isn't in the your workspace. So the requirements.txt.temp file ensures that at least there is always a file available to be copied and the copy command succeeds regardless of whether you have a requirements.txt file in your workspace or not. The wildcard then will copy the actual requirements.txt file if it exists, and then the rm command will remove both of them afterwards so that they don't interfere with the workspace mount. |
@songololo I'll add that the intention is that you copy the entire .devcontainer folder in, or create it using "create container configuration files" command, so you could simplify the steps by starting with the pre-defined containers and then updating the docker file as you see fit. |
@qubitron The good news is that the postCreateCommand is run after the server is provisioned in the running container with the mount. It's the last thing to happen before everything is up. I just checked, and this will install requirements.txt if found: "postCreateCommand": "if [ -f requirements.txt ]; then pip install -r requirements.txt; fi", |
@qubitron I am making a pass through the dev container definitions as a part of #78 to consolidate layers. As a part of that work, I tried moving these to As I said, the only downside is that the env updates do not get baked into the image for rebuilds. The miniconda example is probably the best one to illustrate the problem given its installing Jupyter. It's in the layer-consolidation branch here: https://github.com/microsoft/vscode-dev-containers/tree/layer-consolidation/containers/python-3-miniconda Easy enough to revert - let me know what you htink. |
Was discussing with @brettcannon and he preferred to keep things the way they were, I believe the caching benefits outweigh the complexity of having the additional file. Perhaps we can drop an explanation in the requirements.txt.temp file instead to explain it's purpose? |
@qubitron Yep, we can do that -- along with some additional comments inline in the Dockerfile specifically about the temp file. |
@qubitron @brettcannon Added this to that same branch. I called the file |
Should be resolved in #81. |
python-3
The
python-3
templateDockerfile
requires arequirements.txt.temp
file.If this file is not present, then an error is thrown.
It copies the file into the docker build, but does not appear to do anything with this file.
Have I misunderstood the file's purpose, or is this possibly an artefact from earlier versions?
The text was updated successfully, but these errors were encountered: