|
1 | 1 | FROM mcr.microsoft.com/dotnet/core/sdk:2.1 |
2 | 2 |
|
3 | | -# This Dockerfile adds a non-root user with sudo access. Update the “remoteUser” property in |
4 | | -# devcontainer.json to use it. More info: https://aka.ms/vscode-remote/containers/non-root-user. |
| 3 | +# Options for setup script |
| 4 | +ARG INSTALL_ZSH="true" |
| 5 | +ARG UPGRADE_PACKAGES="false" |
5 | 6 | ARG USERNAME=vscode |
6 | 7 | ARG USER_UID=1000 |
7 | 8 | ARG USER_GID=$USER_UID |
8 | 9 |
|
9 | 10 | # Install needed packages and setup non-root user. Use a separate RUN statement to add your own dependencies. |
10 | | -RUN apt-get update \ |
11 | | - && export DEBIAN_FRONTEND=noninteractive \ |
12 | | - && apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \ |
13 | | - # |
14 | | - # Verify git and needed tools are installed |
15 | | - && apt-get -y install \ |
16 | | - git \ |
17 | | - openssh-client \ |
18 | | - less \ |
19 | | - iproute2 \ |
20 | | - procps \ |
21 | | - curl \ |
22 | | - apt-transport-https \ |
23 | | - gnupg2 \ |
24 | | - lsb-release \ |
25 | | - # |
| 11 | +COPY library-scripts/*.sh /tmp/library-scripts/ |
| 12 | +RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ |
| 13 | + && /bin/bash /tmp/library-scripts/common-debian.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}" \ |
26 | 14 | # Install Azure Functions and Azure CLI |
27 | 15 | && echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $(lsb_release -cs) main" > /etc/apt/sources.list.d/azure-cli.list \ |
28 | 16 | && echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-debian-$(lsb_release -cs)-prod $(lsb_release -cs) main" > /etc/apt/sources.list.d/dotnetdev.list \ |
29 | 17 | && curl -sL https://packages.microsoft.com/keys/microsoft.asc | (OUT=$(apt-key add - 2>&1) || echo $OUT) \ |
30 | 18 | && apt-get update \ |
31 | | - && apt-get install -y azure-cli azure-functions-core-tools \ |
32 | | - # |
33 | | - # Create a non-root user to use if preferred - see https://aka.ms/vscode-remote/containers/non-root-user. |
34 | | - && groupadd --gid $USER_GID $USERNAME \ |
35 | | - && useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \ |
36 | | - # [Optional] Add sudo support for the non-root user |
37 | | - && apt-get install -y sudo \ |
38 | | - && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME\ |
39 | | - && chmod 0440 /etc/sudoers.d/$USERNAME \ |
40 | | - # |
| 19 | + && apt-get install -y azure-cli azure-functions-core-tools-2 \ |
41 | 20 | # Clean up |
42 | | - && apt-get autoremove -y \ |
43 | | - && apt-get clean -y \ |
44 | | - && rm -rf /var/lib/apt/lists/* |
| 21 | + && apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* /tmp/library-scripts |
45 | 22 |
|
46 | 23 | # [Optional] Uncomment this section to install additional OS packages. |
47 | | -# RUN apt-get update \ |
48 | | -# && export DEBIAN_FRONTEND=noninteractive \ |
| 24 | +# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ |
49 | 25 | # && apt-get -y install --no-install-recommends <your-package-list-here> |
0 commit comments