Skip to content

Commit

Permalink
chore: update vscode devcontainer config (#32315)
Browse files Browse the repository at this point in the history
### Issue # (if applicable)

Closes #<issue number here>.

1. remove `sudo` usage in dockerfile
2. upgrade DinD for Apple Silicon

### Reason for this change




### Description of changes



1. following best practice [here](https://semgrep.dev/r?q=dockerfile.security.no-sudo-in-dockerfile.no-sudo-in-dockerfile)
2. upgrade DinD to the latest version to support Apple Silicon.

### Description of how you validated changes



reopen the devcontainer in vscode on my laptop

<img width="496" alt="image" src="https://github.com/user-attachments/assets/dee28dc7-19be-41b6-8d9b-72c0a994c8b0">


### Checklist
- [X] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
5d authored Nov 28, 2024
1 parent f9708a6 commit f271168
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
17 changes: 10 additions & 7 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@ FROM jsii/superchain:1-bookworm-slim-node20

USER root

# Setup oh-my-zsh
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends zsh vim \
&& rm -rf /var/lib/apt/lists/* \
&& chsh -s $(which zsh) superchain

# Required, otherwise shell is extermly slow due the size of the aws-cdk
RUN sh -c 'echo "[oh-my-zsh]\n hide-dirty = 1" > /etc/gitconfig'

# Change uid/guid of superchain so it can work with the docker-in-docker feature
RUN groupmod --gid 1000 superchain \
&& usermod --uid 1000 --gid 1000 superchain \
Expand All @@ -10,10 +19,4 @@ RUN groupmod --gid 1000 superchain \
USER superchain

# Setup oh-my-zsh
RUN sudo apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& sudo apt-get -y install --no-install-recommends zsh vim \
&& sudo rm -rf /var/lib/apt/lists/* \
&& sudo chsh -s $(which zsh) $(whoami)
RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended \
# Required, otherwise shell is extermly slow due the size of the aws-cdk
&& sudo sh -c 'echo "[oh-my-zsh]\n hide-dirty = 1" > /etc/gitconfig'
RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
8 changes: 4 additions & 4 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
"build": {
"dockerfile": "Dockerfile"
},

"customizations": {
"vscode": {
"extensions": ["dbaeumer.vscode-eslint"]
"extensions": [
"dbaeumer.vscode-eslint"
]
}
},

"postCreateCommand": "yarn install",
"remoteUser": "superchain",
"features": {
"docker-in-docker": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {
"version": "latest",
"moby": true
}
Expand Down

0 comments on commit f271168

Please sign in to comment.