|
| 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 condaforge/mambaforge |
| 7 | + |
| 8 | +# Avoid warnings by switching to noninteractive |
| 9 | +ENV DEBIAN_FRONTEND=noninteractive |
| 10 | + |
| 11 | +# This Dockerfile adds a non-root user with sudo access. Use the "remoteUser" |
| 12 | +# property in devcontainer.json to use it. On Linux, the container user's GID/UIDs |
| 13 | +# will be updated to match your local UID/GID (when using the dockerFile property). |
| 14 | +# See https://aka.ms/vscode-remote/containers/non-root-user for details. |
| 15 | +ARG USERNAME=vscode |
| 16 | +ARG USER_UID=1000 |
| 17 | +ARG USER_GID=$USER_UID |
| 18 | + |
| 19 | +# Copy environment.yml (if found) to a temp locaition so we update the environment. Also |
| 20 | +# copy "noop.txt" so the COPY instruction does not fail if no environment.yml exists. |
| 21 | +COPY environment.yml* .devcontainer/noop.txt /tmp/conda-tmp/ |
| 22 | + |
| 23 | +# Configure apt and install packages |
| 24 | +RUN apt-get update \ |
| 25 | + && apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \ |
| 26 | + # |
| 27 | + # Verify git, process tools, lsb-release (common in install instructions for CLIs) installed |
| 28 | + && apt-get -y install git openssh-client less iproute2 procps iproute2 lsb-release \ |
| 29 | + # |
| 30 | + # Install pylint |
| 31 | + && /opt/conda/bin/pip install pylint \ |
| 32 | + # |
| 33 | + # Update Python environment based on environment.yml (if present) |
| 34 | + && if [ -f "/tmp/conda-tmp/environment.yml" ]; then /opt/conda/bin/mamba env update -n base -f /tmp/conda-tmp/environment.yml; fi \ |
| 35 | + && rm -rf /tmp/conda-tmp \ |
| 36 | + # |
| 37 | + # Create a non-root user to use if preferred - see https://aka.ms/vscode-remote/containers/non-root-user. |
| 38 | + && groupadd --gid $USER_GID $USERNAME \ |
| 39 | + && useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \ |
| 40 | + # [Optional] Add sudo support for the non-root user |
| 41 | + && apt-get install -y sudo \ |
| 42 | + && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME\ |
| 43 | + && chmod 0440 /etc/sudoers.d/$USERNAME \ |
| 44 | + # [Additional Customization] |
| 45 | + && apt-get install -y nano vim emacs \ |
| 46 | + # Clean up |
| 47 | + && apt-get autoremove -y \ |
| 48 | + && apt-get clean -y \ |
| 49 | + && rm -rf /var/lib/apt/lists/* |
| 50 | + |
| 51 | +# Switch back to dialog for any ad-hoc use of apt-get |
| 52 | +ENV DEBIAN_FRONTEND=dialog |
0 commit comments