Skip to content

Commit d25a78d

Browse files
authored
CCM-12672: Improve devcontainer build and update asdf (#191)
* chore: Update devcontainer configuration and post-create script for improved SSL certificate handling * chore: Update SSL certificate paths in Dockerfile and post-create script to use combined global + custom certs * chore: Enhance devcontainer setup with improved Zsh configuration and additional dependencies * chore: Enhance devcontainer setup with improved Zsh configuration and additional dependencies * chore: Add asdf shims to devcontainer path * chore: Update devcontainer configuration to streamline post-create command and refine PATH settings * Remove redundant path config * chore: Refine devcontainer configuration by removing redundant remoteEnv and updating PATH in Dockerfile * chore: Add AWS CLI feature and update mounts for AWS configuration * Downgrade Python version to 3.12.11 in .tool-versions to work with proxygen
1 parent c552ef2 commit d25a78d

File tree

5 files changed

+43
-23
lines changed

5 files changed

+43
-23
lines changed

.devcontainer/devcontainer.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
"omzPlugins": "https://github.com/zsh-users/zsh-autosuggestions.git https://github.com/zsh-users/zsh-syntax-highlighting.git",
6464
"plugins": "zsh-autosuggestions zsh-syntax-highlighting"
6565
},
66+
"ghcr.io/devcontainers/features/aws-cli:1": {},
6667
"ghcr.io/devcontainers/features/common-utils": {
6768
"configureZshAsDefaultShell": true,
6869
"installOhMyZsh": true,
@@ -75,11 +76,11 @@
7576
"installDockerComposeSwitch": true,
7677
"moby": true,
7778
"version": "latest"
78-
},
79-
"ghcr.io/devcontainers/features/ruby:1": {}
79+
}
8080
},
8181
"mounts": [
82-
"source=${localEnv:HOME}/.ssh,target=/home/vscode/.ssh,type=bind,consistency=cached"
82+
"source=${localEnv:HOME}/.ssh,target=/home/vscode/.ssh,type=bind,consistency=cached",
83+
"source=${localEnv:HOME}/.aws,target=/home/vscode/.aws,type=bind,consistency=cached"
8384
],
8485
"name": "Devcontainer",
8586
"postCreateCommand": "scripts/devcontainer/postcreatecommand.sh"

.tool-versions

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ gitleaks 8.24.0
33
jq 1.6
44
nodejs 22.15.0
55
pre-commit 3.6.0
6-
python 3.13.2
6+
python 3.12.11
77
terraform 1.10.1
88
terraform-docs 0.19.0
99
trivy 0.61.0

.vscode/settings.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
"**/.svn": true,
99
"**/CVS": true,
1010
"**/Thumbs.db": true,
11-
//".devcontainer": true,
1211
".github": false,
1312
".vscode": false
14-
},
13+
}
1514
}

scripts/devcontainer/Dockerfile

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,42 @@
11
# syntax=docker/dockerfile:1
22
FROM mcr.microsoft.com/devcontainers/base:ubuntu
33

4-
# Copy CA certs and Dynamically set NODE_EXTRA_CA_CERTS accordingly
5-
RUN apt-get update && apt-get install -y ca-certificates
4+
# Copy CA certs and install Ruby and Go via Ubuntu packages (much faster than building from source)
5+
# Also install development libraries needed for Python compilation via asdf
6+
RUN apt-get update && apt-get install -y \
7+
ca-certificates \
8+
ruby-full \
9+
ruby-dev \
10+
build-essential \
11+
golang-go \
12+
libsqlite3-dev \
13+
libbz2-dev \
14+
libncurses-dev \
15+
libffi-dev \
16+
libreadline-dev \
17+
liblzma-dev \
18+
libssl-dev \
19+
zlib1g-dev \
20+
&& rm -rf /var/lib/apt/lists/*
621
COPY custom-ca-certs/. /usr/local/share/ca-certificates/
722
RUN update-ca-certificates
823

9-
# Concatenate all certs for use in EnvVars
10-
RUN find /usr/local/share/ca-certificates -type f \( -name '*.pem' -o -name '*.crt' \) -exec cat {} + > "/usr/local/share/ca-certificates/combined-cacerts.pem"
24+
# Use the updated system CA bundle which now includes both system and custom CAs
25+
ENV NODE_EXTRA_CA_CERTS="/etc/ssl/certs/ca-certificates.crt"
26+
ENV SSL_CERT_FILE="/etc/ssl/certs/ca-certificates.crt"
27+
ENV REQUESTS_CA_BUNDLE="/etc/ssl/certs/ca-certificates.crt"
28+
ENV CURL_CA_BUNDLE="/etc/ssl/certs/ca-certificates.crt"
29+
ENV GIT_SSL_CAINFO="/etc/ssl/certs/ca-certificates.crt"
30+
31+
# Set Go environment variables and prepend asdf shims/bin to PATH
32+
ENV GOPATH="/home/vscode/go"
33+
ENV PATH="/home/vscode/.asdf/shims:/home/vscode/.asdf/bin:/go/bin:${GOPATH}/bin:${PATH}"
1134

1235
# Ensure CA Certs is available for all shells, Node, Python & Ruby
1336
USER vscode
14-
RUN echo 'NODE_EXTRA_CA_CERTS="/usr/local/share/ca-certificates/combined-cacerts.pem"' >> ~/.zshrc
15-
RUN echo 'SSL_CERT_FILE="/usr/local/share/ca-certificates/combined-cacerts.pem"' >> ~/.zshrc
16-
RUN echo 'REQUESTS_CA_BUNDLE="/usr/local/share/ca-certificates/combined-cacerts.pem"' >> ~/.zshrc
17-
RUN echo 'CURL_CA_BUNDLE="/usr/local/share/ca-certificates/combined-cacerts.pem"' >> ~/.zshrc
18-
RUN echo 'GIT_SSL_CAINFO="/usr/local/share/ca-certificates/combined-cacerts.pem"' >> ~/.zshrc
37+
38+
RUN echo 'NODE_EXTRA_CA_CERTS="/etc/ssl/certs/ca-certificates.crt"' >> ~/.zshrc
39+
RUN echo 'SSL_CERT_FILE="/etc/ssl/certs/ca-certificates.crt"' >> ~/.zshrc
40+
RUN echo 'REQUESTS_CA_BUNDLE="/etc/ssl/certs/ca-certificates.crt"' >> ~/.zshrc
41+
RUN echo 'CURL_CA_BUNDLE="/etc/ssl/certs/ca-certificates.crt"' >> ~/.zshrc
42+
RUN echo 'GIT_SSL_CAINFO="/etc/ssl/certs/ca-certificates.crt"' >> ~/.zshrc
Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
1-
#!/bin/bash
2-
3-
rm -Rf ~/.asdf
4-
git clone https://github.com/asdf-vm/asdf.git ~/.asdf;
5-
chmod +x ~/.asdf/asdf.sh;
6-
echo '. $HOME/.asdf/asdf.sh' >> ~/.zshrc
1+
#!/bin/zsh
72

83
echo 'export GPG_TTY=$TTY' | cat - ~/.zshrc > temp && mv temp ~/.zshrc
94

5+
echo 'eval "$(asdf completion zsh)"' >> ~/.zshrc
106
source ~/.zshrc
117

12-
echo 'asdf setup complete'
13-
8+
make _install-dependencies # required before config to ensure python is available due to race between config:: make targets
149
make config
1510

11+
sudo gem install jekyll bundler
1612
jekyll --version && cd docs && bundle install
1713

1814
echo 'jekyll setup complete'

0 commit comments

Comments
 (0)