Skip to content

Commit 2eb3b1e

Browse files
authored
Add dockerfile
1 parent c070cfb commit 2eb3b1e

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

.devcontainer/Dockerfile

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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 rust:1
7+
8+
# This Dockerfile adds a non-root user with sudo access. Use the "remoteUser"
9+
# property in devcontainer.json to use it. On Linux, the container user's GID/UIDs
10+
# will be updated to match your local UID/GID (when using the dockerFile property).
11+
# See https://aka.ms/vscode-remote/containers/non-root-user for details.
12+
ARG USERNAME=vscode
13+
ARG USER_UID=1000
14+
ARG USER_GID=$USER_UID
15+
16+
# Configure apt and install packages
17+
RUN apt-get update \
18+
&& export DEBIAN_FRONTEND=noninteractive \
19+
&& apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \
20+
#
21+
# Verify git, needed tools installed
22+
&& apt-get -y install git openssh-client less iproute2 procps lsb-release \
23+
#
24+
# Install lldb, vadimcn.vscode-lldb VSCode extension dependencies
25+
&& apt-get install -y lldb python3-minimal libpython3.7 \
26+
#
27+
# Install Rust components
28+
&& rustup update 2>&1 \
29+
&& rustup component add rls rust-analysis rust-src rustfmt clippy 2>&1 \
30+
#
31+
# Create a non-root user to use if preferred - see https://aka.ms/vscode-remote/containers/non-root-user.
32+
&& groupadd --gid $USER_GID $USERNAME \
33+
&& useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \
34+
# [Optional] Add sudo support for the non-root user
35+
&& apt-get install -y sudo \
36+
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME\
37+
&& chmod 0440 /etc/sudoers.d/$USERNAME \
38+
#
39+
# Clean up
40+
&& apt-get autoremove -y \
41+
&& apt-get clean -y \
42+
&& rm -rf /var/lib/apt/lists/*

0 commit comments

Comments
 (0)