Skip to content

Commit

Permalink
Merge pull request #170 from adamrushuk/develop
Browse files Browse the repository at this point in the history
v1.3.0 release
  • Loading branch information
adamrushuk authored Jan 17, 2021
2 parents 02e4695 + a0529d3 commit 2f1f4f1
Show file tree
Hide file tree
Showing 61 changed files with 2,031 additions and 502 deletions.
67 changes: 62 additions & 5 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,63 @@
# Find the Dockerfile for mcr.microsoft.com/azure-functions/powershell:3.0-powershell${VARIANT}-core-tools at this URL
# https://github.com/Azure/azure-functions-docker/blob/master/host/3.0/buster/amd64/powershell
# azure-terraform image
#
# reference:
# https://github.com/microsoft/vscode-dev-containers
# https://hub.docker.com/_/microsoft-vscode-devcontainers
# https://github.com/microsoft/vscode-dev-containers/blob/master/containers/azure-terraform/.devcontainer/Dockerfile

# Update the VARIANT arg in devcontainer.json to pick a supported PowerShell version: 7, 6
ARG VARIANT=7
FROM mcr.microsoft.com/azure-functions/powershell:3.0-powershell${VARIANT}-core-tools
# You can pick any Debian/Ubuntu-based image. 😊
FROM mcr.microsoft.com/vscode/devcontainers/base:ubuntu-18.04

COPY library-scripts/*.sh /tmp/library-scripts/

# [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
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& bash /tmp/library-scripts/common-debian.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}" \
&& apt-get install -y graphviz \
&& apt-get clean -y && rm -rf /var/lib/apt/lists/*

# [Option] Install Azure CLI
ARG INSTALL_AZURE_CLI="true"
# [Option] Install Docker CLI
ARG INSTALL_DOCKER="true"
# [Option] Install Node.js
ARG INSTALL_NODE="true"
ARG NODE_VERSION="lts/*"
ENV NVM_DIR=/usr/local/share/nvm
ENV NVM_SYMLINK_CURRENT=true \
PATH=${NVM_DIR}/current/bin:${PATH}
RUN if [ "${INSTALL_AZURE_CLI}" = "true" ]; then bash /tmp/library-scripts/azcli-debian.sh; fi \
&& if [ "${INSTALL_NODE}" = "true" ]; then bash /tmp/library-scripts/node-debian.sh "${NVM_DIR}" "${NODE_VERSION}" "${USERNAME}"; fi \
&& if [ "${INSTALL_DOCKER}" = "true" ]; then \
bash /tmp/library-scripts/docker-debian.sh "true" "/var/run/docker-host.sock" "/var/run/docker.sock" "${USERNAME}"; \
else \
echo '#!/bin/bash\n"$@"' > /usr/local/share/docker-init.sh && chmod +x /usr/local/share/docker-init.sh; \
fi \
&& rm -rf /var/lib/apt/lists/*

# Install Terraform, tflint, Go, PowerShell, and other useful tools
# TODO: move this into main "RUN" layer above
ARG TERRAFORM_VERSION=0.12.30
ARG TFLINT_VERSION=0.18.0
RUN bash /tmp/library-scripts/terraform-debian.sh "${TERRAFORM_VERSION}" "${TFLINT_VERSION}" \
&& bash /tmp/library-scripts/powershell-debian.sh \
&& bash /tmp/library-scripts/kubectl-helm-debian.sh \
&& bash /tmp/library-scripts/terraform-pre-commit.sh \
&& bash /tmp/library-scripts/tflint-plugins.sh \
&& bash /tmp/library-scripts/go-debian.sh \
&& rm -rf /tmp/library-scripts

ENTRYPOINT [ "/usr/local/share/docker-init.sh" ]
CMD [ "sleep", "infinity" ]

# [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>
48 changes: 31 additions & 17 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,31 +1,45 @@
// For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at:
// https://github.com/microsoft/vscode-dev-containers/blob/master/containers/azure-functions-pwsh/README.md
// https://github.com/microsoft/vscode-dev-containers/blob/master/containers/azure-terraform/.devcontainer/devcontainer.json
{
"name": "Azure Functions & PowerShell",
"name": "Azure Terraform",
"build": {
"dockerfile": "Dockerfile",
"args": {
// Update the VARIANT arg to pick a supported PowerShell version: 7, 6
"VARIANT": "7"
"TERRAFORM_VERSION": "0.12.30",
"TFLINT_VERSION": "0.22.0",
"INSTALL_AZURE_CLI": "true",
"INSTALL_DOCKER": "true",
"INSTALL_NODE": "true"
}
},
"forwardPorts": [ 7071 ],
"mounts": [ "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" ],

"mounts": [
"source=/var/run/docker.sock,target=/var/run/docker-host.sock,type=bind"
],
"overrideCommand": false,
// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.shell.linux": "/usr/bin/pwsh"
"terminal.integrated.shell.linux": "/bin/bash"
},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"ms-azuretools.vscode-azurefunctions",
"ms-vscode.powershell"
]

"hashicorp.terraform",
"ms-azuretools.vscode-azureterraform",
"ms-vscode.azurecli",
"ms-azuretools.vscode-docker",
"aaron-bond.better-comments",
"coenraads.bracket-pair-colorizer-2",
"eamodio.gitlens",
"ms-kubernetes-tools.vscode-kubernetes-tools",
"yzhang.markdown-all-in-one",
"davidanson.vscode-markdownlint",
"ziyasal.vscode-open-in-github",
"ms-vscode.powershell",
"redhat.vscode-yaml",
],
// 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": "dotnet restore",

// Uncomment to connect as a non-root user. See https://aka.ms/vscode-remote/containers/non-root.
// "remoteUser": "vscode"
// "postCreateCommand": "terraform --version",
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
}
5 changes: 5 additions & 0 deletions .devcontainer/library-scripts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Warning: Folder contents may be replaced

The contents of this folder will be automatically replaced with a file of the same name in the repository's [script-library folder](https://github.com/microsoft/vscode-dev-containers/tree/master/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.
33 changes: 33 additions & 0 deletions .devcontainer/library-scripts/azcli-debian.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env bash
#-------------------------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
#-------------------------------------------------------------------------------------------------------------
#
# Docs: https://github.com/microsoft/vscode-dev-containers/blob/master/script-library/docs/azcli.md
#
# Syntax: ./azcli-debian.sh

set -e

if [ "$(id -u)" -ne 0 ]; then
echo -e 'Script must be run as root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.'
exit 1
fi

export DEBIAN_FRONTEND=noninteractive

# Install curl, apt-transport-https, lsb-release, or gpg if missing
if ! dpkg -s apt-transport-https curl ca-certificates lsb-release > /dev/null 2>&1 || ! type gpg > /dev/null 2>&1; then
if [ ! -d "/var/lib/apt/lists" ] || [ "$(ls /var/lib/apt/lists/ | wc -l)" = "0" ]; then
apt-get update
fi
apt-get -y install --no-install-recommends apt-transport-https curl ca-certificates lsb-release gnupg2
fi

# Install the Azure CLI
echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $(lsb_release -cs) main" > /etc/apt/sources.list.d/azure-cli.list
curl -sL https://packages.microsoft.com/keys/microsoft.asc | (OUT=$(apt-key add - 2>&1) || echo $OUT)
apt-get update
apt-get install -y azure-cli
echo "Done!"
Loading

0 comments on commit 2f1f4f1

Please sign in to comment.