Skip to content

Commit

Permalink
Trying to get a devenv working for vscode
Browse files Browse the repository at this point in the history
  • Loading branch information
Cashmaney committed Jul 18, 2022
1 parent a6071fa commit deecf4f
Show file tree
Hide file tree
Showing 10 changed files with 1,077 additions and 57 deletions.
55 changes: 55 additions & 0 deletions deployment/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
FROM baiduxlab/sgx-rust:2004-1.1.3

ENV PATH="/root/.cargo/bin:$PATH"
ENV GOROOT=/usr/local/go
ENV GOPATH=/go/
ENV PATH=$PATH:/usr/local/go/bin:$GOPATH/bin
ENV GO111MODULE=auto

# Use the [Option] comment to specify true/false arguments that should appear in VS Code UX
#
# [Option] Install zsh
ARG INSTALL_ZSH="true"
# [Option] Upgrade OS packages to their latest versions
ARG UPGRADE_PACKAGES="false"

# Install needed packages and setup non-root user. Use a separate RUN statement to add your own dependencies.
ARG USERNAME=vscode
ARG USER_UID=1000
ARG USER_GID=$USER_UID

ENV USER_HOME=/home/${USERNAME}/

ENV CARGO_HOME=${USER_HOME}/.cargo/bin
ENV RUSTUP_HOME=${USER_HOME}/.cargo/bin

COPY deployment/.devcontainer/library-scripts/*.sh deployment/.devcontainer/library-scripts/*.env /tmp/library-scripts/
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& /bin/bash /tmp/library-scripts/common-debian.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}" "true" "true"\
#
# ****************************************************************************
# * TODO: Add any additional OS packages you want included in the definition *
# * here. We want to do this before cleanup to keep the "layer" small. *
# ****************************************************************************
# && apt-get -y install --no-install-recommends <your-package-list-here> \
# \
&& bash /tmp/library-scripts/rust-debian.sh "${CARGO_HOME}" "${RUSTUP_HOME}" "${USERNAME}" "true" "true" \
&& bash /tmp/library-scripts/go-debian.sh "none" "${GOROOT}" "${GOPATH}" "${USERNAME}" "false" \
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* /tmp/library-scripts

# [Optional] Uncomment this section to install additional OS packages.
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# && apt-get -y install --no-install-recommends <your-package-list-here>
RUN wget -q https://github.com/WebAssembly/wabt/releases/download/1.0.20/wabt-1.0.20-ubuntu.tar.gz && \
tar -xf wabt-1.0.20-ubuntu.tar.gz wabt-1.0.20/bin/wat2wasm wabt-1.0.20/bin/wasm2wat && \
mv wabt-1.0.20/bin/wat2wasm wabt-1.0.20/bin/wasm2wat /bin && \
chmod +x /bin/wat2wasm /bin/wasm2wat && \
rm -f wabt-1.0.20-ubuntu.tar.gz

RUN go install github.com/jteeuwen/go-bindata/go-bindata@latest && go-bindata -version

WORKDIR ${USER_HOME}

RUN git clone https://github.com/scrtlabs/SecretNetwork.git

WORKDIR ${USER_HOME}/SecretNetwork
68 changes: 68 additions & 0 deletions deployment/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"name": "Secret Network Core Dev Environment",

// Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
"build": {
"dockerfile": "Dockerfile"
// [Optional] You can use build args to set options. e.g. 'VARIANT' below affects the image in the Dockerfile
// "args": { "VARIANT": "buster" }
"args": {
"NODE_VERSION": "lts/*"
}
},

// Set *default* container specific settings.json values on container create.
"settings": {},

// Add the IDs of extensions you want installed when the container is created.
"workspaceFolder": "/go/src/github.com/enigmampc/SecretNetwork",
"extensions": [
"bungcip.better-toml",
"rust-lang.rust",
"rust-lang.rust-analyzer",
"golang.Go"
],

"customizations": {
"vscode": {
// Set *default* container specific settings.json values on container create.
"settings": {
"go.toolsManagement.checkForUpdates": "local",
"go.useLanguageServer": true,
"go.gopath": "/go",
"lldb.executable": "/usr/bin/lldb",
// VS Code don't watch files under ./target
"files.watcherExclude": {
"**/target/**": true
},
"rust-analyzer.checkOnSave.command": "clippy"
},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"vadimcn.vscode-lldb",
"mutantdino.resourcemonitor",
"rust-lang.rust-analyzer",
"tamasfe.even-better-toml",
"serayuzgur.crates",
"golang.Go"
]
}
},


// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "uname -a",

// Uncomment to use Docker from inside the container. See https://aka.ms/vscode-remote/samples/docker-from-docker.
// "mounts": [ "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" ],

// Uncomment when using a ptrace-based debugger like C++, Go, and Rust
"runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ],

// Comment out to connect as root instead. To add a non-root user, see: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
},
7 changes: 7 additions & 0 deletions deployment/.devcontainer/library-scripts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Warning: Folder contents may be replaced

The contents of this folder will be automatically replaced with a file of the same name in the [vscode-dev-containers](https://github.com/microsoft/vscode-dev-containers) repository's [script-library folder](https://github.com/microsoft/vscode-dev-containers/tree/main/script-library) whenever the repository is packaged. To retain your edits, move the file to a different location. You may also delete the files if they are not needed.

## Adding a new script from the script-library folder

When creating a dev container for the vscode-dev-containers repository, simply drop a copy of the script you want to use from the [script-library folder](https://github.com/microsoft/vscode-dev-containers/tree/main/script-library) into this folder and it will be automatically kept up to date as things change.
Loading

0 comments on commit deecf4f

Please sign in to comment.