Skip to content

Commit 3e89f78

Browse files
committed
dev: improve devcontainer env
1 parent 04f91d5 commit 3e89f78

File tree

3 files changed

+29
-21
lines changed

3 files changed

+29
-21
lines changed

.devcontainer/Dockerfile

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,40 @@
11
FROM mcr.microsoft.com/vscode/devcontainers/base:1-focal
22

3-
# Install AWS CLI
4-
RUN apt-get update && \
5-
apt-get install -y unzip python3-pip && \
6-
pip3 install --no-cache-dir --upgrade awscli && \
7-
apt-get clean && \
8-
rm -rf /var/lib/apt/lists/*
9-
10-
# Install Node.js
11-
ENV NODE_VERSION=18.x
12-
RUN curl -sL https://deb.nodesource.com/setup_${NODE_VERSION} | bash - && \
13-
apt-get install -y nodejs && \
14-
npm install -g typescript
15-
16-
# Install Docker CLI
17-
COPY --from=docker:dind /usr/local/bin/docker /usr/local/bin/
3+
# install aws
4+
RUN SYSTEM_ARCH=$(uname -m) \
5+
&& curl "https://awscli.amazonaws.com/awscli-exe-linux-${SYSTEM_ARCH}.zip" -o "awscliv2.zip" \
6+
&& unzip awscliv2.zip \
7+
&& aws/install \
8+
&& aws --version \
9+
&& rm -rf aws
1810

19-
# Install Terraform
11+
# install terraform
2012
ENV TERRAFORM_VERSION=1.5.1
2113
ENV TF_PLUGIN_CACHE_DIR=$HOME/.terraform.d/plugin-cache
14+
RUN mkdir -p $TF_PLUGIN_CACHE_DIR
2215
RUN SYSTEM_ARCH=$(dpkg --print-architecture) \
23-
&& mkdir -p $TF_PLUGIN_CACHE_DIR \
2416
&& curl -OL https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_${SYSTEM_ARCH}.zip \
2517
&& unzip terraform_${TERRAFORM_VERSION}_linux_${SYSTEM_ARCH}.zip \
2618
&& mv terraform /usr/local/bin/ \
2719
&& terraform version \
2820
&& rm terraform_${TERRAFORM_VERSION}_linux_${SYSTEM_ARCH}.zip
2921

30-
# Install Open Policy Agent
22+
# install docker
23+
COPY --from=docker:dind /usr/local/bin/docker /usr/local/bin/
24+
25+
# install node.js
26+
ENV NODE_VERSION=18.x
27+
RUN curl -sL https://deb.nodesource.com/setup_${NODE_VERSION} | bash - && \
28+
apt-get install -y nodejs
29+
30+
# install typescript
31+
RUN npm install -g typescript
32+
33+
# install opa
3134
RUN wget https://github.com/open-policy-agent/opa/releases/latest/download/opa_linux_amd64 -O /usr/local/bin/opa && \
3235
chmod +x /usr/local/bin/opa
3336

34-
# Verify Installs
37+
# verify installs
3538
RUN terraform --version \
3639
&& aws --version \
3740
&& node --version \

.devcontainer/devcontainer.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@
44
"features": {
55
"ghcr.io/devcontainers/features/docker-in-docker:2.0.1": {},
66
},
7+
"mounts": [
8+
"source=${localEnv:HOME}/.aws,target=/home/vscode/.aws,type=bind,consistency=cached"
9+
],
710
"containerEnv": {
8-
"TF_PLUGIN_CACHE_DIR": "/workspaces/terraform-aws-cognito-custom-message-sender/.devcontainer/tmp/.terraform.d/"
11+
"TF_PLUGIN_CACHE_DIR": "${containerWorkspaceFolder}/.devcontainer/tmp/.terraform.d/"
912
},
1013
"customizations": {
1114
"vscode": {
@@ -28,7 +31,9 @@
2831
"dbaeumer.vscode-eslint",
2932
"editorconfig.editorconfig",
3033
"github.copilot",
34+
"github.copilot-chat",
3135
"github.vscode-github-actions",
36+
"github.vscode-pull-request-github",
3237
"hashicorp.terraform",
3338
"ms-azuretools.vscode-docker",
3439
"tsandall.opa",

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ following tools:
3434
1. Clone this repository:
3535

3636
```bash
37-
git clone https://github.com/cruxstack/terraform-docker-artifact-packager.git
37+
git clone https://github.com/cruxstack/terraform-aws-cognito-custom-message-sender.git
3838
code terraform-aws-cognito-custom-message-sender
3939
```
4040

0 commit comments

Comments
 (0)