Skip to content
This repository has been archived by the owner on Nov 30, 2023. It is now read-only.

Don't run pip install -r requirements.txt in the Dockerfile #111

Merged
merged 1 commit into from
Aug 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions containers/python-3/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@ ARG USERNAME=vscode
ARG USER_UID=1000
ARG USER_GID=$USER_UID

# Copy requirements.txt (if found) to a temp location so we can install it. The `*`
# is required so COPY doesn't think that part of the command should fail is nothing is
# found. Also copy "noop.txt" so the COPY instruction copies _something_ to guarantee
# success somehow.
COPY *requirements.txt .devcontainer/noop.txt /tmp/pip-tmp/
# Uncomment the following COPY line and the corresponding lines in the `RUN` command if you wish to
# include your requirements in the image itself. It is suggested that you only do this if your
# requirements rarely (if ever) change.
# COPY requirements.txt /tmp/pip-tmp/

# Configure apt and install packages
RUN apt-get update \
Expand All @@ -29,9 +28,9 @@ RUN apt-get update \
# Install pylint
&& pip --disable-pip-version-check --no-cache-dir install pylint \
#
# Update Python environment based on requirements.txt (if presenet)
&& if [ -f "/tmp/pip-tmp/requirements.txt" ]; then pip --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt; fi \
&& rm -rf /tmp/pip-tmp \
# Update Python environment based on requirements.txt
# && pip --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt \
# && rm -rf /tmp/pip-tmp \
#
# Create a non-root user to use if preferred - see https://aka.ms/vscode-remote/containers/non-root-user.
&& groupadd --gid $USER_GID $USERNAME \
Expand Down
2 changes: 1 addition & 1 deletion containers/python-3/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// "appPort": [],

// Uncomment the next line to run commands after the container is created.
// "postCreateCommand": "python --version",
// "postCreateCommand": "pip install -r requirements.txt",

// Uncomment the next line to use a non-root user. See https://aka.ms/vscode-remote/containers/non-root-user.
// "runArgs": [ "-u", "1000" ],
Expand Down
3 changes: 0 additions & 3 deletions containers/python-3/.devcontainer/noop.txt

This file was deleted.

6 changes: 3 additions & 3 deletions containers/python-3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

## Summary

*Develop Python 3 applications. Installs dependencies from your requirements.txt file and the Python extension.*
*Develop Python 3 applications.*

| Metadata | Value |
| Metadata | Value |
|----------|-------|
| *Contributors* | The [VS Code Python extension](https://marketplace.visualstudio.com/itemdetails?itemName=ms-python.python) team |
| *Definition type* | Dockerfile |
| *Languages, platforms* | Python |

## Using this definition with an existing folder

For convenience, this definition will automatically install dependencies from your `requirements.txt` file when the container is built. Also note that only the integrated terminal is supported by the Remote - Containers extension. You may need to modify `launch.json` configurations to include the following value if an external console is used.
Note that only the integrated terminal is supported by the Remote - Containers extension. You may need to modify `launch.json` configurations to include the following value if an external console is used.

```json
"console": "integratedTerminal"
Expand Down