Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

Devcontainer: Move global tool installs into another script so they can be cached #2365

Merged
merged 2 commits into from
Sep 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,16 @@ ARG RUSTVERSION="1.63"
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends \
libunwind-dev clang build-essential libssl-dev pkg-config lldb \
bash-completion npm python-is-python3 \
dotnet6
bash-completion npm dotnet6 \
python-is-python3 direnv uuid-runtime python3-distutils python3-pip

# Install Rust:
USER vscode
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain ${RUSTVERSION} -y

# Install other dependencies:
COPY install-dependencies.sh .
RUN ./install-dependencies.sh

USER root
RUN rm install-dependencies.sh
3 changes: 1 addition & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
"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
"features": {
"azure-cli": "latest",
"python": "os-provided"
"azure-cli": "latest"
}
}
23 changes: 23 additions & 0 deletions .devcontainer/install-dependencies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

set -eux

# Note that this script runs as user 'vscode' during devcontainer setup.

# Rust global tools, needed to run CI scripts
"$HOME/.cargo/bin/cargo" install cargo-audit cargo-license@0.4.2

# NPM global tools
sudo npm install -g azurite azure-functions-core-tools@4

# Pip global tools
pip install wheel

# Other binaries
echo "Installing azcopy ..."
tmpdir=$(mktemp -d)
pushd "$tmpdir"
wget https://aka.ms/downloadazcopy-v10-linux -O - | tar -zxv
sudo cp ./azcopy_linux_amd64_*/azcopy /usr/bin/
popd
rm -rf "$tmpdir"
20 changes: 1 addition & 19 deletions .devcontainer/post-create-script.sh
Original file line number Diff line number Diff line change
@@ -1,24 +1,9 @@
#!/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 ..."
# note that 'dotnet' feature in devcontainer.json already sets up the PPA for this
sudo apt 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/

# Install Azurite
sudo npm install -g azurite
set -eux

# Restore rust dependencies
echo "Restoring rust dependencies"
cargo install cargo-audit cargo-license@0.4.2 # requirements if you want to run ci/agent.sh
cd /workspaces/onefuzz/src/agent
cargo fetch

Expand All @@ -27,9 +12,6 @@ echo "Restore dotnet dependencies"
cd /workspaces/onefuzz/src/ApiService
dotnet restore

sudo apt-get install direnv uuid-runtime
pip install wheel

echo "Setting up venv"
cd /workspaces/onefuzz/src
python -m venv venv
Expand Down
Empty file modified src/utils/lint.sh
100644 → 100755
Empty file.