mirror of
https://github.com/microsoft/onefuzz.git
synced 2025-06-16 20:08:09 +00:00
Add dev container (#1822)
* starting * Add post create script * Fixing up scripts * Clean up dockerfile
This commit is contained in:
@ -16,23 +16,10 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive && apt-get install -
|
|||||||
# Install packages required for build:
|
# Install packages required for build:
|
||||||
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
||||||
&& apt-get -y install --no-install-recommends \
|
&& apt-get -y install --no-install-recommends \
|
||||||
libunwind-dev clang build-essential libssl-dev pkg-config lldb \
|
libunwind-dev clang build-essential libssl-dev pkg-config lldb
|
||||||
python3-minimal \
|
|
||||||
dotnet-sdk-6.0
|
|
||||||
|
|
||||||
### Setup Rust for 'vscode' user:
|
### Setup Rust for 'vscode' user:
|
||||||
USER vscode
|
USER vscode
|
||||||
|
|
||||||
# Install Rust:
|
|
||||||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain 1.60 -y
|
|
||||||
|
|
||||||
ENV PATH="/home/vscode/.cargo/bin:${PATH}"
|
|
||||||
|
|
||||||
# Install Rust components:
|
|
||||||
RUN rustup component add rls rust-analysis rust-src rustfmt clippy
|
|
||||||
|
|
||||||
# Install required cargo commands:
|
|
||||||
RUN cargo install cargo-audit cargo-license sccache
|
|
||||||
|
|
||||||
USER root
|
USER root
|
||||||
### Done setting up Rust.
|
### Done setting up Rust.
|
||||||
|
@ -26,11 +26,20 @@
|
|||||||
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||||
// "forwardPorts": [],
|
// "forwardPorts": [],
|
||||||
// Use 'postCreateCommand' to run commands after the container is created.
|
// Use 'postCreateCommand' to run commands after the container is created.
|
||||||
"postCreateCommand": "find -iname '*.csproj' -exec dotnet restore '{}' \\;",
|
"postCreateCommand": "chmod u+x .devcontainer/post-create-script.sh; ./.devcontainer/post-create-script.sh",
|
||||||
// - ensure all nuget packages are present
|
// - ensure all nuget packages are present
|
||||||
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
|
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
|
||||||
"remoteUser": "vscode",
|
"remoteUser": "vscode",
|
||||||
// Note: available features are listed in: https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/container-features/src/devcontainer-features.json
|
// Note: available features are listed in: https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/container-features/src/devcontainer-features.json
|
||||||
"features": {
|
"features": {
|
||||||
|
"azure-cli": "latest",
|
||||||
|
"python": "3.8",
|
||||||
|
"dotnet": {
|
||||||
|
"version": "latest"
|
||||||
|
},
|
||||||
|
"rust": {
|
||||||
|
"version": "latest",
|
||||||
|
"profile": "default"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
55
.devcontainer/post-create-script.sh
Executable file
55
.devcontainer/post-create-script.sh
Executable file
@ -0,0 +1,55 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Install Azure Functions Core Tools 4
|
||||||
|
# Source: https://docs.microsoft.com/en-us/azure/azure-functions/functions-run-local?tabs=v4%2Clinux%2Ccsharp%2Cportal%2Cbash
|
||||||
|
echo "Installing Azure Functions Core Tools 4 ..."
|
||||||
|
cd /tmp
|
||||||
|
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
|
||||||
|
sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
|
||||||
|
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-$(lsb_release -cs)-prod $(lsb_release -cs) main" > /etc/apt/sources.list.d/dotnetdev.list'
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install azure-functions-core-tools-4
|
||||||
|
|
||||||
|
# Install azcopy
|
||||||
|
echo "Installing azcopy ..."
|
||||||
|
cd /tmp
|
||||||
|
wget https://aka.ms/downloadazcopy-v10-linux
|
||||||
|
tar -xvf downloadazcopy-v10-linux
|
||||||
|
sudo cp ./azcopy_linux_amd64_*/azcopy /usr/bin/
|
||||||
|
|
||||||
|
# Restore rust dependencies
|
||||||
|
echo "Restoring rust dependencies"
|
||||||
|
cd /workspaces/onefuzz/src/agent
|
||||||
|
cargo fetch
|
||||||
|
|
||||||
|
# Restore dotnet dependencies
|
||||||
|
echo "Restore dotnet dependencies"
|
||||||
|
cd /workspaces/onefuzz/src/ApiService
|
||||||
|
dotnet restore
|
||||||
|
|
||||||
|
sudo apt-get install direnv
|
||||||
|
|
||||||
|
echo "Setting up venv"
|
||||||
|
cd /workspaces/onefuzz/src
|
||||||
|
python -m venv venv
|
||||||
|
. ./venv/bin/activate
|
||||||
|
|
||||||
|
echo "Installing pytypes"
|
||||||
|
cd /workspaces/onefuzz/src/pytypes
|
||||||
|
echo "layout python3" >> .envrc
|
||||||
|
direnv allow
|
||||||
|
pip install -e .
|
||||||
|
|
||||||
|
echo "Installing cli"
|
||||||
|
cd /workspaces/onefuzz/src/cli
|
||||||
|
echo "layout python3" >> .envrc
|
||||||
|
direnv allow
|
||||||
|
pip install -e .
|
||||||
|
|
||||||
|
echo "Install api-service"
|
||||||
|
cd /workspaces/onefuzz/src/api-service
|
||||||
|
echo "layout python3" >> .envrc
|
||||||
|
direnv allow
|
||||||
|
pip install -r requirements-dev.txt
|
||||||
|
cd __app__
|
||||||
|
pip install -r requirements.txt
|
23
.devcontainer/workspace.code-workspace
Normal file
23
.devcontainer/workspace.code-workspace
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"folders": [
|
||||||
|
{
|
||||||
|
"path": ".."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../src/agent"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../src/api-service"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../src/ApiService"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../src/cli"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../src/pytypes"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"settings": {}
|
||||||
|
}
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -4,6 +4,7 @@
|
|||||||
.idea
|
.idea
|
||||||
**/.direnv
|
**/.direnv
|
||||||
**/.envrc
|
**/.envrc
|
||||||
|
**/venv
|
||||||
|
|
||||||
# vim
|
# vim
|
||||||
*.swp
|
*.swp
|
||||||
|
Reference in New Issue
Block a user