Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding resource type for VS Code Remote Development #5

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
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
67 changes: 67 additions & 0 deletions resource-types/VSCodeRemoteDevelopment/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
FROM mcr.microsoft.com/vscode/devcontainers/base:ubuntu-18.04

# get back to root because we like danger
USER 0
ENV HOME=/root

# Get to latest versions of all packages
RUN apt-get update && apt-get -y upgrade --no-install-recommends

# Install common dependencies
RUN apt-get -y install --no-install-recommends \
build-essential \
git \
openssh-client \
less \
iproute2 \
procps \
curl \
wget \
unzip \
nano \
jq \
lsb-release \
ca-certificates \
apt-transport-https \
dialog \
gnupg2 \
libc6 \
libgcc1 \
libgssapi-krb5-2 \
libicu[0-9][0-9] \
liblttng-ust0 \
libstdc++6 \
zlib1g \
locales

# Node.js
RUN curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash - \
&& sudo apt-get install -y nodejs

# Python
RUN apt install -y software-properties-common \
&& add-apt-repository -y ppa:deadsnakes/ppa \
&& apt-get -y install --no-install-recommends python3.7 python3-pip

# Docker
RUN apt-get install -y apt-transport-https ca-certificates curl lsb-release \
&& curl -fsSL https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/gpg | apt-key add - 2>/dev/null \
&& echo "deb [arch=amd64] https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]') $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list \
&& apt-get update \
&& apt-get install -y docker-ce-cli \
&& LATEST_COMPOSE_VERSION=1.25.5 curl -sSL "https://github.com/docker/compose/releases/download/${LATEST_COMPOSE_VERSION}/docker-compose-Linux-x86_64" -o /usr/local/bin/docker-compose \
&& chmod +x /usr/local/bin/docker-compose

# AWS CLI v2
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" \
&& unzip awscliv2.zip \
&& ./aws/install \
&& rm -rf awscliv2.zip aws

# CDK
RUN npm install -g aws-cdk && npm install -g typescript

# Cleanup
RUN apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "AWS Cloud Dev Container",
"dockerFile": "Dockerfile",
// "image": "mcr.microsoft.com/vscode/devcontainers/base:ubuntu-18.04",

// Use 'settings' to set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
},

// Add the IDs of extensions you want installed when the container is created in the array below.
"extensions": [
"ms-python.python",
"vscode-snippet.snippet",
"4tron.stack-overflow-view",
"kenhowardpdx.vscode-gist",
"aws-amplify.aws-amplify-vscode",
"amazonwebservices.aws-toolkit-vscode",
"aws-scripting-guy.cform",
"ms-azuretools.vscode-docker"
],

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

"workspaceFolder": "/mnt/ebs/fs1/workspace",
"workspaceMount": "source=/mnt/ebs/fs1/workspace,target=/mnt/ebs/fs1/workspace,type=bind,consistency=cached",

// Mounts Docker socket into the container so that you can use Docker.
"mounts": [
"source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind",
"source=/mnt/ebs/fs1/home,target=/root,type=bind,consistency=cached"
]
}
34 changes: 34 additions & 0 deletions resource-types/VSCodeRemoteDevelopment/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Distribution / packaging
build/
dist/

# Unit test / coverage reports
.cache
.hypothesis/
.pytest_cache/

# RPDK logs
rpdk.log

# Node.js
node_modules/
coverage/

# CDK
cdk.out/

# cfn cli build output
awssamples-devtools-devinstance.zip

# personal VS Code config
.vscode/settings.json

# env file for local testing
env.json

# envrc
.envrc

# sam
sam.log
.aws-sam
1 change: 1 addition & 0 deletions resource-types/VSCodeRemoteDevelopment/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
optional = true
11 changes: 11 additions & 0 deletions resource-types/VSCodeRemoteDevelopment/.rpdk-config
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"typeName": "AWSSamples::Devtools::Devinstance",
"language": "typescript",
"runtime": "nodejs12.x",
"entrypoint": "dist/handlers.entrypoint",
"testEntrypoint": "dist/handlers.testEntrypoint",
"settings": {
"useDocker": true,
"protocolVersion": "2.0.0"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// make a copy of this file as .vscode/settings.json and set your SSH URI
{
"docker.host": "ssh://ec2-user@<YOUR_SSH_HOST>"
}
82 changes: 82 additions & 0 deletions resource-types/VSCodeRemoteDevelopment/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
FROM mcr.microsoft.com/vscode/devcontainers/base:ubuntu-18.04

# get back to root because we like danger
USER 0
ENV HOME=/root

# Get to latest versions of all packages
RUN apt-get update && apt-get -y upgrade --no-install-recommends

# Install common dependencies
RUN apt-get -y install --no-install-recommends \
build-essential \
git \
openssh-client \
less \
iproute2 \
procps \
curl \
wget \
unzip \
nano \
jq \
lsb-release \
ca-certificates \
apt-transport-https \
dialog \
gnupg2 \
libc6 \
libgcc1 \
libgssapi-krb5-2 \
libicu[0-9][0-9] \
liblttng-ust0 \
libstdc++6 \
zlib1g \
locales

# Node.js
RUN curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash - \
&& sudo apt-get install -y nodejs

# Python
RUN apt install -y software-properties-common \
&& add-apt-repository -y ppa:deadsnakes/ppa \
&& apt-get -y install --no-install-recommends python3.7 python3-pip

# Docker
RUN apt-get install -y apt-transport-https ca-certificates curl lsb-release \
&& curl -fsSL https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/gpg | apt-key add - 2>/dev/null \
&& echo "deb [arch=amd64] https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]') $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list \
&& apt-get update \
&& apt-get install -y docker-ce-cli \
&& LATEST_COMPOSE_VERSION=1.25.5 curl -sSL "https://github.com/docker/compose/releases/download/${LATEST_COMPOSE_VERSION}/docker-compose-Linux-x86_64" -o /usr/local/bin/docker-compose \
&& chmod +x /usr/local/bin/docker-compose

# AWS CLI v2
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" \
&& unzip awscliv2.zip \
&& ./aws/install \
&& rm -rf awscliv2.zip aws

# CDK
RUN npm install -g aws-cdk && npm install -g typescript

# SAM CLI & AWS CloudFormation Resource Provider TypeScript Plugin
RUN curl https://raw.githubusercontent.com/Homebrew/install/master/install.sh -o brew.sh \
&& sed -i "s/abort \"Don't run this as root\!\"/echo \"Don't run this as root\!\"/" brew.sh \
&& chmod +x brew.sh \
&& ./brew.sh \
&& rm -rf brew.sh \
&& eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv) \
&& echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.profile \
&& brew tap aws/tap \
&& brew install aws-sam-cli \
&& pip3 install setuptools \
&& pip3 install wheel \
&& pip3 install git+https://github.com/eduardomourar/[email protected]#egg=cloudformation-cli-typescript-plugin \
&& pip3 install cloudformation-cli==0.1.*

# Cleanup
RUN apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*
Loading