|
5 | 5 |
|
6 | 6 | FROM node:8 |
7 | 7 |
|
8 | | -# Configure apt |
| 8 | +# Avoid warnings by switching to noninteractive |
9 | 9 | ENV DEBIAN_FRONTEND=noninteractive |
10 | | -RUN apt-get update \ |
11 | | - && apt-get -y install --no-install-recommends apt-utils 2>&1 |
12 | 10 |
|
13 | | -# Verify git and needed tools are installed |
14 | | -RUN apt-get install -y git procps |
| 11 | +# The node image comes with a base non-root 'node' user which this Dockerfile |
| 12 | +# gives sudo access. However, for Linux, this user's GID/UID must match your local |
| 13 | +# user UID/GID to avoid permission issues with bind mounts. Update USER_UID / USER_GID |
| 14 | +# if yours is not 1000. See https://aka.ms/vscode-remote/containers/non-root-user. |
| 15 | +ARG USER_UID=1000 |
| 16 | +ARG USER_GID=$USER_UID |
15 | 17 |
|
16 | | -# Remove outdated yarn from /opt and install via package |
17 | | -# so it can be easily updated via apt-get upgrade yarn |
18 | | -RUN rm -rf /opt/yarn-* \ |
| 18 | +# Configure apt and install packages |
| 19 | +RUN apt-get update \ |
| 20 | + && apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \ |
| 21 | + # |
| 22 | + # Verify git and needed tools are installed |
| 23 | + && apt-get -y install git iproute2 procps \ |
| 24 | + # |
| 25 | + # Remove outdated yarn from /opt and install via package |
| 26 | + # so it can be easily updated via apt-get upgrade yarn |
| 27 | + && rm -rf /opt/yarn-* \ |
19 | 28 | && rm -f /usr/local/bin/yarn \ |
20 | 29 | && rm -f /usr/local/bin/yarnpkg \ |
21 | 30 | && apt-get install -y curl apt-transport-https lsb-release \ |
22 | 31 | && curl -sS https://dl.yarnpkg.com/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/pubkey.gpg | apt-key add - 2>/dev/null \ |
23 | 32 | && echo "deb https://dl.yarnpkg.com/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/ stable main" | tee /etc/apt/sources.list.d/yarn.list \ |
24 | 33 | && apt-get update \ |
25 | | - && apt-get -y install --no-install-recommends yarn |
26 | | - |
27 | | -# Install tslint and typescript |
28 | | -RUN npm install -g tslint typescript |
29 | | - |
30 | | -# Clean up |
31 | | -RUN apt-get autoremove -y \ |
| 34 | + && apt-get -y install --no-install-recommends yarn \ |
| 35 | + # |
| 36 | + # Install tslint and typescript globally |
| 37 | + && npm install -g tslint typescript \ |
| 38 | + # |
| 39 | + # [Optional] Update a non-root user to match UID/GID - see https://aka.ms/vscode-remote/containers/non-root-user. |
| 40 | + && if [ "$USER_GID" != "1000" ]; then groupmod node --gid $USER_GID; fi \ |
| 41 | + && if [ "$USER_UID" != "1000" ]; then usermod --uid $USER_UID node; fi \ |
| 42 | + # [Optional] Add add sudo support for non-root user |
| 43 | + && apt-get install -y sudo \ |
| 44 | + && echo node ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/node \ |
| 45 | + && chmod 0440 /etc/sudoers.d/node \ |
| 46 | + # |
| 47 | + # Clean up |
| 48 | + && apt-get autoremove -y \ |
32 | 49 | && apt-get clean -y \ |
33 | 50 | && rm -rf /var/lib/apt/lists/* |
34 | | -ENV DEBIAN_FRONTEND=dialog |
| 51 | + |
| 52 | +# Switch back to dialog for any ad-hoc use of apt-get |
| 53 | +ENV DEBIAN_FRONTEND= |
0 commit comments