|
| 1 | +#------------------------------------------------------------------------------------------------------------- |
| 2 | +# Copyright (c) Microsoft Corporation. All rights reserved. |
| 3 | +# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information. |
| 4 | +#------------------------------------------------------------------------------------------------------------- |
| 5 | + |
| 6 | +FROM node:12 |
| 7 | + |
| 8 | +# Avoid warnings by switching to noninteractive |
| 9 | +ENV DEBIAN_FRONTEND=noninteractive |
| 10 | + |
| 11 | +# The node image includes a non-root user with sudo access. Use the |
| 12 | +# "remoteUser" property in devcontainer.json to use it. On Linux, update |
| 13 | +# these values to ensure the container user's UID/GID matches your local values. |
| 14 | +# See https://aka.ms/vscode-remote/containers/non-root-user for details. |
| 15 | +ARG USERNAME=node |
| 16 | +ARG USER_UID=1000 |
| 17 | +ARG USER_GID=$USER_UID |
| 18 | + |
| 19 | +# Configure apt and install packages |
| 20 | +RUN apt-get update \ |
| 21 | + && apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \ |
| 22 | + # |
| 23 | + # Verify git and needed tools are installed |
| 24 | + && apt-get -y install git iproute2 procps \ |
| 25 | + # |
| 26 | + # Remove outdated yarn from /opt and install via package |
| 27 | + # so it can be easily updated via apt-get upgrade yarn |
| 28 | + && rm -rf /opt/yarn-* \ |
| 29 | + && rm -f /usr/local/bin/yarn \ |
| 30 | + && rm -f /usr/local/bin/yarnpkg \ |
| 31 | + && apt-get install -y curl apt-transport-https lsb-release \ |
| 32 | + && curl -sS https://dl.yarnpkg.com/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/pubkey.gpg | apt-key add - 2>/dev/null \ |
| 33 | + && echo "deb https://dl.yarnpkg.com/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/ stable main" | tee /etc/apt/sources.list.d/yarn.list \ |
| 34 | + && apt-get update \ |
| 35 | + && apt-get -y install --no-install-recommends yarn tmux locales \ |
| 36 | + # |
| 37 | + # Install eslint globally |
| 38 | + && npm install -g eslint \ |
| 39 | + # |
| 40 | + # [Optional] Update a non-root user to UID/GID if needed. |
| 41 | + && if [ "$USER_GID" != "1000" ] || [ "$USER_UID" != "1000" ]; then \ |
| 42 | + groupmod --gid $USER_GID $USERNAME \ |
| 43 | + && usermod --uid $USER_UID --gid $USER_GID $USERNAME \ |
| 44 | + && chown -R $USER_UID:$USER_GID /home/$USERNAME; \ |
| 45 | + fi \ |
| 46 | + # [Optional] Add add sudo support for non-root user |
| 47 | + && apt-get install -y sudo \ |
| 48 | + && echo node ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ |
| 49 | + && chmod 0440 /etc/sudoers.d/$USERNAME \ |
| 50 | + # |
| 51 | + # Clean up |
| 52 | + && apt-get autoremove -y \ |
| 53 | + && apt-get clean -y \ |
| 54 | + && rm -rf /var/lib/apt/lists/* |
| 55 | + |
| 56 | +RUN curl https://raw.githubusercontent.com/brianc/dotfiles/master/.tmux.conf > ~/.tmux.conf |
| 57 | + |
| 58 | +# install nvm |
| 59 | +RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh | bash |
| 60 | + |
| 61 | +# Set the locale |
| 62 | +RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && locale-gen |
| 63 | +ENV LANG en_US.UTF-8 |
| 64 | +ENV LANGUAGE en_US:en |
| 65 | +ENV LC_ALL en_US.UTF-8 |
| 66 | + |
| 67 | +# Switch back to dialog for any ad-hoc use of apt-get |
| 68 | +ENV DEBIAN_FRONTEND=dialog |
0 commit comments