Skip to content

Commit f277e95

Browse files
feat: use devcontainer/terraform/init make target
1 parent fa9136f commit f277e95

File tree

1 file changed

+8
-99
lines changed

1 file changed

+8
-99
lines changed

.devcontainer/Dockerfile

Lines changed: 8 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -1,114 +1,23 @@
1-
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2-
# SPDX-License-Identifier: MIT-0
3-
4-
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.234.0/containers/ubuntu/.devcontainer/base.Dockerfile
5-
6-
# [Choice] Ubuntu version (use ubuntu-22.04 or ubuntu-18.04 on local arm64/Apple Silicon): ubuntu-22.04, ubuntu-20.04, ubuntu-18.04
71
ARG VARIANT="jammy"
82
FROM mcr.microsoft.com/vscode/devcontainers/base:0-${VARIANT}
93

104
# Install OS packages
115
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
126
&& apt-get -y install --no-install-recommends \
13-
ca-certificates \
14-
curl \
15-
expect \
16-
figlet \
17-
gawk \
18-
git \
19-
git-flow \
20-
golang \
21-
gnupg \
22-
jq \
23-
less \
24-
make \
25-
python3-pip \
26-
software-properties-common \
27-
ssh \
28-
tree \
29-
bash-completion \
30-
unzip \
31-
vim \
32-
wget \
33-
&& rm -rf /var/lib/apt/lists/*
34-
35-
RUN update-ca-certificates
36-
37-
# Terraform
38-
RUN curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add - \
39-
&& apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main" \
40-
&& apt-get update && sudo apt-get -qq install --no-install-recommends --yes terraform terraform-ls
7+
make
418

42-
# AWS CLI
43-
SHELL ["/bin/zsh", "-c"]
44-
RUN mkdir -p /tmp/download \
45-
&& cd /tmp/download \
46-
&& curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" --silent -o "awscliv2.zip" \
47-
&& unzip -qq awscliv2.zip \
48-
&& ./aws/install \
49-
&& rm -rf /tmp/download \
50-
&& autoload bashcompinit && bashcompinit \
51-
&& autoload -Uz compinit && compinit \
52-
&& echo "complete -C '/usr/local/bin/aws_completer' aws" >> /home/vscode/.bashrc \
53-
&& echo "complete -C '/usr/local/bin/aws_completer' aws" >> /home/vscode/.zshrc
54-
55-
# Gomplate
56-
ARG GOMPLATE_VERSION=3.10.0
57-
RUN mkdir -p /tmp/download \
58-
&& wget https://github.com/hairyhenderson/gomplate/releases/download/v${GOMPLATE_VERSION}/gomplate_linux-amd64-slim -O /tmp/download/gomplate --quiet --no-check-certificate \
59-
&& chmod +x /tmp/download/gomplate \
60-
&& mv /tmp/download/gomplate /usr/local/bin/ \
61-
&& rm -rf /tmp/download
9+
USER vscode
6210

63-
# Terraform Docs
6411
ARG TERRAFORM_DOCS_VERSION=0.16.0
65-
RUN mkdir -p /tmp/download /tmp/extract \
66-
&& wget https://github.com/terraform-docs/terraform-docs/releases/download/v${TERRAFORM_DOCS_VERSION}/terraform-docs-v${TERRAFORM_DOCS_VERSION}-linux-amd64.tar.gz -O /tmp/download/terraform-docs-${TERRAFORM_DOCS_VERSION}-linux-amd64.tar.gz --quiet --no-check-certificate \
67-
&& tar -C /tmp/extract -xzf /tmp/download/terraform-docs-${TERRAFORM_DOCS_VERSION}-linux-amd64.tar.gz \
68-
&& mv /tmp/extract/terraform-docs /usr/local/bin/ \
69-
&& rm -rf /tmp/download /tmp/extract
70-
71-
# TFLINT
72-
ARG TFLINT_AWS_RULESET_VERSION=0.13.4
73-
RUN curl https://raw.githubusercontent.com/terraform-linters/tflint/master/install_linux.sh | bash
74-
75-
# TFSEC
7612
ARG TFSEC_VERSION=1.15.2
77-
RUN mkdir -p /tmp/download \
78-
&& wget https://github.com/aquasecurity/tfsec/releases/download/v${TFSEC_VERSION}/tfsec-linux-amd64 -O /tmp/download/tfsec --quiet --no-check-certificate \
79-
&& chmod +x /tmp/download/tfsec \
80-
&& mv /tmp/download/tfsec /usr/local/bin/ \
81-
&& rm -rf /tmp/download
82-
83-
# TFSWITCH
84-
RUN curl -L https://raw.githubusercontent.com/warrensbox/terraform-switcher/release/install.sh | bash
85-
86-
# TERRASCAN
8713
ARG TERRASCAN_VERSION=1.13.2
88-
RUN mkdir -p /tmp/download /tmp/extract \
89-
&& wget https://github.com/accurics/terrascan/releases/download/v${TERRASCAN_VERSION}/terrascan_${TERRASCAN_VERSION}_Linux_x86_64.tar.gz -O /tmp/download/terrascan_${TERRASCAN_VERSION}_Linux_x86_64.tar.gz --quiet --no-check-certificate \
90-
&& sha256sum /tmp/download/terrascan_${TERRASCAN_VERSION}_Linux_x86_64.tar.gz \
91-
&& tar -C /tmp/extract -xzf /tmp/download/terrascan_${TERRASCAN_VERSION}_Linux_x86_64.tar.gz \
92-
&& sudo mv /tmp/extract/terrascan /usr/local/bin/ \
93-
&& rm -rf /tmp/download /tmp/extract
94-
95-
# Gitignore CLI
96-
RUN echo "function gi() { curl -sL https://www.toptal.com/developers/gitignore/api/\$@ ;}" >> /home/vscode/.bashrc
97-
RUN echo "function gi() { curl -sLw "\n" https://www.toptal.com/developers/gitignore/api/\$@ ;}" >> /home/vscode/.zshrc
98-
99-
# Upgrade pip
100-
RUN pip3 install --progress-bar off --upgrade pip
101-
102-
USER vscode
103-
104-
# Install pre-commit
105-
RUN pip3 install --progress-bar off --upgrade --user pre-commit
106-
107-
# Install checkov
108-
RUN pip3 install --progress-bar off --upgrade --user checkov
14+
ARG TFLINT_AWS_RULESET_VERSION=0.21.1
10915

110-
# Install Ansible
111-
RUN pip3 install --progress-bar off --upgrade --user ansible
16+
RUN cd /tmp/ \
17+
&& git clone https://github.com/awslabs/aws-code-habits.git \
18+
&& cd aws-code-habits \
19+
&& make devcontainer/terraform/init \
20+
&& rm -rf /tmp/aws-code-habits
11221

11322
USER root
11423

0 commit comments

Comments
 (0)