Skip to content

Commit f195a02

Browse files
author
Azure DevOps CI
committed
added devcontainer
1 parent 822fb36 commit f195a02

File tree

5 files changed

+88
-1
lines changed

5 files changed

+88
-1
lines changed

.devcontainer/Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/rust/.devcontainer/base.Dockerfile
2+
3+
# [Choice] Debian OS version (use bullseye on local arm64/Apple Silicon): buster, bullseye
4+
ARG VARIANT="buster"
5+
FROM mcr.microsoft.com/vscode/devcontainers/rust:0-${VARIANT}
6+
7+
# [Optional] Uncomment this section to install additional packages.
8+
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
9+
# && apt-get -y install --no-install-recommends <your-package-list-here>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Write-Host "PowerShell scripts here if required..."
2+
3+
sudo chmod +x .devcontainer/postStartCommand.sh

.devcontainer/devcontainer.json

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
2+
// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/rust
3+
{
4+
"name": "Rust",
5+
"build": {
6+
"dockerfile": "Dockerfile",
7+
"args": {
8+
// Use the VARIANT arg to pick a Debian OS version: buster, bullseye
9+
// Use bullseye when on local on arm64/Apple Silicon.
10+
"VARIANT": "bullseye"
11+
}
12+
},
13+
"runArgs": [
14+
"--cap-add=SYS_PTRACE",
15+
"--security-opt",
16+
"seccomp=unconfined"
17+
],
18+
// Configure tool-specific properties.
19+
"customizations": {
20+
// Configure properties specific to VS Code.
21+
"vscode": {
22+
// Set *default* container specific settings.json values on container create.
23+
"settings": {
24+
"lldb.executable": "/usr/bin/lldb",
25+
// VS Code don't watch files under ./target
26+
"files.watcherExclude": {
27+
"**/target/**": true
28+
},
29+
"rust-analyzer.checkOnSave.command": "clippy"
30+
},
31+
// Add the IDs of extensions you want installed when the container is created.
32+
"extensions": [
33+
"vadimcn.vscode-lldb",
34+
"mutantdino.resourcemonitor",
35+
"rust-lang.rust-analyzer",
36+
"tamasfe.even-better-toml",
37+
"serayuzgur.crates",
38+
"ms-azuretools.vscode-docker",
39+
"ms-vscode-remote.vscode-remote-extensionpack",
40+
"ms-azure-devops.azure-pipelines"
41+
]
42+
}
43+
},
44+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
45+
// "forwardPorts": [],
46+
// Use 'postCreateCommand' to run commands after the container is created.
47+
// "postCreateCommand": "rustc --version",
48+
"postCreateCommand": "pwsh ./.devcontainer/Invoke-PostCreateCommand.ps1",
49+
"postStartCommand": "./.devcontainer/postStartCommand.sh",
50+
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
51+
"remoteUser": "vscode",
52+
"features": {
53+
"docker-from-docker": "latest",
54+
"powershell": "latest"
55+
}
56+
}

.devcontainer/postStartCommand.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/sh
2+
3+
sudo apt-get update
4+
sudo apt-get upgrade -y
5+
6+
rustup --version
7+
#rustup toolchain install nightly --component rust-analyzer-preview
8+
9+
rustc --version
10+
11+
# alias cls="clear"
12+
# alias cc="cargo check"
13+
# alias cb="cargo build"
14+
# alias cr="cargo run"
15+
16+
echo "Done"

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1+
!.vscode/extensions.json
2+
.vscode/*
3+
14
# Generated by Cargo
25
# will have compiled files and executables
36
/target/
47

58
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
69
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
7-
Cargo.lock
10+
#Cargo.lock
811

912
# These are backup files generated by rustfmt
1013
**/*.rs.bk

0 commit comments

Comments
 (0)