Skip to content

Instantly share code, notes, and snippets.

@rich-nahra
Last active September 4, 2019 11:28
Show Gist options
  • Save rich-nahra/cc49a1357b13b29f36783ff982b8026b to your computer and use it in GitHub Desktop.
Save rich-nahra/cc49a1357b13b29f36783ff982b8026b to your computer and use it in GitHub Desktop.
vscode .devcontainer for dotnet cdk development
#-------------------------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
#-------------------------------------------------------------------------------------------------------------
FROM node:stretch
# Avoid warnings by switching to noninteractive
ENV DEBIAN_FRONTEND=noninteractive
ENV AWS_CLI_VERSION=1.16.230
ENV AWS_CDK_VERSION=1.6.1
ENV DOTNET_CLI_TELEMETRY_OPTOUT=1
# Or your actual UID, GID on Linux if not the default 1000
ARG USERNAME=cdkuser
ARG USER_UID=1001
ARG USER_GID=$USER_UID
# Configure apt and install packages
RUN apt-get update \
&& apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \
#
# Verify git, process tools, lsb-release (common in install instructions for CLIs) installed
&& apt-get -y install git procps lsb-release \
#
# Create a non-root user to use if preferred - see https://aka.ms/vscode-remote/containers/non-root-user.
&& groupadd --gid $USER_GID $USERNAME \
&& useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \
# [Optional] Add sudo support for non-root user
&& wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb -O /tmp/packages-microsoft-prod.deb \
&& apt-get install -y sudo \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME \
&& apt-get install -y python-pip apt-transport-https \
&& dpkg -i /tmp/packages-microsoft-prod.deb \
&& apt-get update \
&& apt-get install -y dotnet-sdk-2.1=2.1.300-1 \
&& pip --no-cache-dir install ansible \
&& pip --no-cache-dir install boto3 \
&& pip --no-cache-dir install boto \
&& pip --no-cache-dir install awscli \
&& npm -g install aws-cdk \
#
# Clean up#&& rm -rf fonts \
&& apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -y fonts-powerline
USER $USERNAME
RUN cd /home/$USERNAME \
&& git clone https://github.com/chris-marsh/pureline.git /home/$USERNAME/pureline --depth=1 && git clone https://github.com/powerline/fonts.git /home/$USERNAME/fonts --depth=1 \
&& cp pureline/configs/powerline_full_256col.conf /home/$USERNAME/.pureline.conf \
&& whoami \
&& fonts/install.sh \
&& whoami \
&& echo 'source ~/pureline/pureline ~/.pureline.conf' >> /home/$USERNAME/.bashrc
# Switch back to dialog for any ad-hoc use of apt-get
ENV DEBIAN_FRONTEND=
{
"name": "AWS DevOps Image",
"dockerFile": "Dockerfile",
"appPort": [22, 8000],
"extensions": [
"ms-vscode.csharp",
"amazonwebservices.aws-toolkit-vscode",
"ms-kubernetes-tools.vscode-kubernetes-tools",
"aws-scripting-guy.cform"
],
"runArgs": [ "-v", "${env:HOME}${env:USERPROFILE}/.aws:/home/cdkuser/.aws", "-u", "cdkuser" ],
"settings": {
"telemetry.enableTelemetry": false,
"aws.profile": "default",
"workbench.colorCustomizations": {
"terminal.background" : "#0a0a0a"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment