|
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 |
3 | 7 |
|
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> |
0 commit comments