|
3 | 3 | # Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information. |
4 | 4 | #------------------------------------------------------------------------------------------------------------- |
5 | 5 |
|
6 | | -FROM python:3.7 |
| 6 | +FROM python:3 |
7 | 7 |
|
8 | 8 | # Avoid warnings by switching to noninteractive |
9 | 9 | ENV DEBIAN_FRONTEND=noninteractive |
10 | 10 |
|
11 | | -# Copy requirements.txt (if found) to a temp locaition so we can install it. Also |
12 | | -# copy "noop.txt" so the COPY instruction does not fail if no requirements.txt exists. |
13 | | -COPY requirements.txt* .devcontainer/noop.txt /tmp/pip-tmp/ |
| 11 | +# Or your actual UID, GID on Linux if not the default 1000 |
| 12 | +ARG USERNAME=vscode |
| 13 | +ARG USER_UID=1000 |
| 14 | +ARG USER_GID=$USER_UID |
| 15 | + |
| 16 | +# Copy requirements.txt (if found) to a temp location so we can install it. The `*` |
| 17 | +# is required so COPY doesn't think that part of the command should fail is nothing is |
| 18 | +# found. Also copy "noop.txt" so the COPY instruction copies _something_ to guarantee |
| 19 | +# success somehow. |
| 20 | +COPY *requirements.txt .devcontainer/noop.txt /tmp/pip-tmp/ |
14 | 21 |
|
15 | 22 | # Configure apt and install packages |
16 | 23 | RUN apt-get update \ |
17 | | - && apt-get -y install --no-install-recommends apt-utils 2>&1 \ |
| 24 | + && apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \ |
18 | 25 | # |
19 | 26 | # Verify git, process tools, lsb-release (common in install instructions for CLIs) installed |
20 | 27 | && apt-get -y install git procps lsb-release \ |
21 | 28 | # |
22 | 29 | # Install pylint |
23 | | - && pip install pylint \ |
| 30 | + && pip --disable-pip-version-check --no-cache-dir install pylint \ |
24 | 31 | # |
25 | 32 | # Update Python environment based on requirements.txt (if presenet) |
26 | | - && if [ -f "/tmp/pip-tmp/requirements.txt" ]; then pip install -r /tmp/pip-tmp/requirements.txt; fi \ |
| 33 | + && if [ -f "/tmp/pip-tmp/requirements.txt" ]; then pip --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt; fi \ |
27 | 34 | && rm -rf /tmp/pip-tmp \ |
28 | 35 | # |
| 36 | + # Create a non-root user to use if preferred - see https://aka.ms/vscode-remote/containers/non-root-user. |
| 37 | + && groupadd --gid $USER_GID $USERNAME \ |
| 38 | + && useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \ |
| 39 | + # [Optional] Uncomment the next three lines to add sudo support |
| 40 | + # && apt-get install -y sudo \ |
| 41 | + # && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ |
| 42 | + # && chmod 0440 /etc/sudoers.d/$USERNAME \ |
| 43 | + # |
29 | 44 | # Clean up |
30 | 45 | && apt-get autoremove -y \ |
31 | 46 | && apt-get clean -y \ |
32 | 47 | && rm -rf /var/lib/apt/lists/* |
33 | 48 |
|
34 | 49 | # Switch back to dialog for any ad-hoc use of apt-get |
35 | | -ENV DEBIAN_FRONTEND=dialog |
| 50 | +ENV DEBIAN_FRONTEND= |
36 | 51 |
|
37 | 52 |
|
0 commit comments