Skip to content

Commit 2f1f4f1

Browse files
authored
Merge pull request #170 from adamrushuk/develop
v1.3.0 release
2 parents 02e4695 + a0529d3 commit 2f1f4f1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+2031
-502
lines changed

.devcontainer/Dockerfile

Lines changed: 62 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,63 @@
1-
# Find the Dockerfile for mcr.microsoft.com/azure-functions/powershell:3.0-powershell${VARIANT}-core-tools at this URL
2-
# https://github.com/Azure/azure-functions-docker/blob/master/host/3.0/buster/amd64/powershell
1+
# azure-terraform image
2+
#
3+
# reference:
4+
# https://github.com/microsoft/vscode-dev-containers
5+
# https://hub.docker.com/_/microsoft-vscode-devcontainers
6+
# https://github.com/microsoft/vscode-dev-containers/blob/master/containers/azure-terraform/.devcontainer/Dockerfile
37

4-
# Update the VARIANT arg in devcontainer.json to pick a supported PowerShell version: 7, 6
5-
ARG VARIANT=7
6-
FROM mcr.microsoft.com/azure-functions/powershell:3.0-powershell${VARIANT}-core-tools
8+
# You can pick any Debian/Ubuntu-based image. 😊
9+
FROM mcr.microsoft.com/vscode/devcontainers/base:ubuntu-18.04
10+
11+
COPY library-scripts/*.sh /tmp/library-scripts/
12+
13+
# [Option] Install zsh
14+
ARG INSTALL_ZSH="true"
15+
# [Option] Upgrade OS packages to their latest versions
16+
ARG UPGRADE_PACKAGES="false"
17+
18+
# Install needed packages and setup non-root user. Use a separate RUN statement to add your own dependencies.
19+
ARG USERNAME=vscode
20+
ARG USER_UID=1000
21+
ARG USER_GID=$USER_UID
22+
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
23+
&& bash /tmp/library-scripts/common-debian.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}" \
24+
&& apt-get install -y graphviz \
25+
&& apt-get clean -y && rm -rf /var/lib/apt/lists/*
26+
27+
# [Option] Install Azure CLI
28+
ARG INSTALL_AZURE_CLI="true"
29+
# [Option] Install Docker CLI
30+
ARG INSTALL_DOCKER="true"
31+
# [Option] Install Node.js
32+
ARG INSTALL_NODE="true"
33+
ARG NODE_VERSION="lts/*"
34+
ENV NVM_DIR=/usr/local/share/nvm
35+
ENV NVM_SYMLINK_CURRENT=true \
36+
PATH=${NVM_DIR}/current/bin:${PATH}
37+
RUN if [ "${INSTALL_AZURE_CLI}" = "true" ]; then bash /tmp/library-scripts/azcli-debian.sh; fi \
38+
&& if [ "${INSTALL_NODE}" = "true" ]; then bash /tmp/library-scripts/node-debian.sh "${NVM_DIR}" "${NODE_VERSION}" "${USERNAME}"; fi \
39+
&& if [ "${INSTALL_DOCKER}" = "true" ]; then \
40+
bash /tmp/library-scripts/docker-debian.sh "true" "/var/run/docker-host.sock" "/var/run/docker.sock" "${USERNAME}"; \
41+
else \
42+
echo '#!/bin/bash\n"$@"' > /usr/local/share/docker-init.sh && chmod +x /usr/local/share/docker-init.sh; \
43+
fi \
44+
&& rm -rf /var/lib/apt/lists/*
45+
46+
# Install Terraform, tflint, Go, PowerShell, and other useful tools
47+
# TODO: move this into main "RUN" layer above
48+
ARG TERRAFORM_VERSION=0.12.30
49+
ARG TFLINT_VERSION=0.18.0
50+
RUN bash /tmp/library-scripts/terraform-debian.sh "${TERRAFORM_VERSION}" "${TFLINT_VERSION}" \
51+
&& bash /tmp/library-scripts/powershell-debian.sh \
52+
&& bash /tmp/library-scripts/kubectl-helm-debian.sh \
53+
&& bash /tmp/library-scripts/terraform-pre-commit.sh \
54+
&& bash /tmp/library-scripts/tflint-plugins.sh \
55+
&& bash /tmp/library-scripts/go-debian.sh \
56+
&& rm -rf /tmp/library-scripts
57+
58+
ENTRYPOINT [ "/usr/local/share/docker-init.sh" ]
59+
CMD [ "sleep", "infinity" ]
60+
61+
# [Optional] Uncomment this section to install additional OS packages.
62+
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
63+
# && apt-get -y install --no-install-recommends <your-package-list-here>

.devcontainer/devcontainer.json

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,45 @@
11
// For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at:
2-
// https://github.com/microsoft/vscode-dev-containers/blob/master/containers/azure-functions-pwsh/README.md
2+
// https://github.com/microsoft/vscode-dev-containers/blob/master/containers/azure-terraform/.devcontainer/devcontainer.json
33
{
4-
"name": "Azure Functions & PowerShell",
4+
"name": "Azure Terraform",
55
"build": {
66
"dockerfile": "Dockerfile",
77
"args": {
8-
// Update the VARIANT arg to pick a supported PowerShell version: 7, 6
9-
"VARIANT": "7"
8+
"TERRAFORM_VERSION": "0.12.30",
9+
"TFLINT_VERSION": "0.22.0",
10+
"INSTALL_AZURE_CLI": "true",
11+
"INSTALL_DOCKER": "true",
12+
"INSTALL_NODE": "true"
1013
}
1114
},
12-
"forwardPorts": [ 7071 ],
13-
"mounts": [ "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" ],
14-
15+
"mounts": [
16+
"source=/var/run/docker.sock,target=/var/run/docker-host.sock,type=bind"
17+
],
18+
"overrideCommand": false,
1519
// Set *default* container specific settings.json values on container create.
1620
"settings": {
17-
"terminal.integrated.shell.linux": "/usr/bin/pwsh"
21+
"terminal.integrated.shell.linux": "/bin/bash"
1822
},
19-
2023
// Add the IDs of extensions you want installed when the container is created.
2124
"extensions": [
22-
"ms-azuretools.vscode-azurefunctions",
23-
"ms-vscode.powershell"
24-
]
25-
25+
"hashicorp.terraform",
26+
"ms-azuretools.vscode-azureterraform",
27+
"ms-vscode.azurecli",
28+
"ms-azuretools.vscode-docker",
29+
"aaron-bond.better-comments",
30+
"coenraads.bracket-pair-colorizer-2",
31+
"eamodio.gitlens",
32+
"ms-kubernetes-tools.vscode-kubernetes-tools",
33+
"yzhang.markdown-all-in-one",
34+
"davidanson.vscode-markdownlint",
35+
"ziyasal.vscode-open-in-github",
36+
"ms-vscode.powershell",
37+
"redhat.vscode-yaml",
38+
],
39+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
40+
// "forwardPorts": [],
2641
// Use 'postCreateCommand' to run commands after the container is created.
27-
// "postCreateCommand": "dotnet restore",
28-
29-
// Uncomment to connect as a non-root user. See https://aka.ms/vscode-remote/containers/non-root.
30-
// "remoteUser": "vscode"
42+
// "postCreateCommand": "terraform --version",
43+
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
44+
"remoteUser": "vscode"
3145
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Warning: Folder contents may be replaced
2+
3+
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.
4+
5+
To retain your edits, move the file to a different location. You may also delete the files if they are not needed.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/env bash
2+
#-------------------------------------------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
5+
#-------------------------------------------------------------------------------------------------------------
6+
#
7+
# Docs: https://github.com/microsoft/vscode-dev-containers/blob/master/script-library/docs/azcli.md
8+
#
9+
# Syntax: ./azcli-debian.sh
10+
11+
set -e
12+
13+
if [ "$(id -u)" -ne 0 ]; then
14+
echo -e 'Script must be run as root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.'
15+
exit 1
16+
fi
17+
18+
export DEBIAN_FRONTEND=noninteractive
19+
20+
# Install curl, apt-transport-https, lsb-release, or gpg if missing
21+
if ! dpkg -s apt-transport-https curl ca-certificates lsb-release > /dev/null 2>&1 || ! type gpg > /dev/null 2>&1; then
22+
if [ ! -d "/var/lib/apt/lists" ] || [ "$(ls /var/lib/apt/lists/ | wc -l)" = "0" ]; then
23+
apt-get update
24+
fi
25+
apt-get -y install --no-install-recommends apt-transport-https curl ca-certificates lsb-release gnupg2
26+
fi
27+
28+
# Install the Azure CLI
29+
echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $(lsb_release -cs) main" > /etc/apt/sources.list.d/azure-cli.list
30+
curl -sL https://packages.microsoft.com/keys/microsoft.asc | (OUT=$(apt-key add - 2>&1) || echo $OUT)
31+
apt-get update
32+
apt-get install -y azure-cli
33+
echo "Done!"

0 commit comments

Comments
 (0)