Skip to content

Commit

Permalink
feat(sage-monorepo): add hadolint binary and extension for VS Code (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
tschaffter authored Mar 19, 2024
1 parent 9d7d34e commit bc24dc4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 17 deletions.
1 change: 1 addition & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"eamodio.gitlens",
"emeraldwalk.RunOnSave",
"esbenp.prettier-vscode",
"exiasr.hadolint",
"formulahendry.auto-rename-tag",
"github.vscode-github-actions",
"GitHub.vscode-pull-request-github",
Expand Down
42 changes: 25 additions & 17 deletions tools/devcontainers/sage/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ ARG playwrightVersion="1.40.1"
ARG pnpmVersion="8.7.0"
# https://github.com/SonarSource/sonar-scanner-cli/releases
ARG sonarScannerVersion="5.0.1.3006"
# https://github.com/hadolint/hadolint
ARG hadolintVersion="2.12.0"

# Create the docker group so that we can assign it to the user.
# This is to enable the non-root user to use the command `docker`.
Expand All @@ -48,18 +50,24 @@ RUN groupadd docker \
make build-essential libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \
xz-utils tk-dev libffi-dev liblzma-dev \
# Required by Hadolint
shellcheck \
# Add Node.js repository
&& mkdir -p /etc/apt/keyrings \
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key \
| gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
&& NODE_MAJOR=18 \
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" \
| tee /etc/apt/sources.list.d/nodesource.list \
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key \
| gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
&& NODE_MAJOR=18 \
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" \
| tee /etc/apt/sources.list.d/nodesource.list \
# Add Hadolint
&& curl https://github.com/hadolint/hadolint/releases/download/v${hadolintVersion}/hadolint-Linux-x86_64 -o hadolint \
&& mv hadolint /usr/local/bin/. \
&& chmod +x /usr/local/bin/hadolint \
# Add GitHub CLI repository
&& curl -sSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | \
gpg --dearmor -o /usr/share/keyrings/githubcli-archive-keyring.gpg \
gpg --dearmor -o /usr/share/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | \
tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
# Add ngrok repository
&& curl -s https://ngrok-agent.s3.amazonaws.com/ngrok.asc | tee /etc/apt/trusted.gpg.d/ngrok.asc >/dev/null \
&& echo "deb https://ngrok-agent.s3.amazonaws.com bullseye main" | tee /etc/apt/sources.list.d/ngrok.list \
Expand Down Expand Up @@ -105,15 +113,15 @@ RUN groupadd docker \
&& ln -s /etc/poetry/bin/poetry /usr/local/bin/. \
# Install R
&& curl "https://cdn.rstudio.com/r/ubuntu-2204/pkgs/r-${rVersion}_1_amd64.deb" -o /tmp/r_amd64.deb \
&& gdebi --non-interactive /tmp/r_amd64.deb \
&& rm -fr /tmp/r_amd64.deb \
&& ln -s /opt/R/${rVersion}/bin/R /usr/local/bin/R \
&& ln -s /opt/R/${rVersion}/bin/Rscript /usr/local/bin/Rscript \
&& R -e "options(repos = c(POSIT = \"https://packagemanager.posit.co/all/__linux__/jammy/latest\", CRAN = \"https://mirror.las.iastate.edu/CRAN\")); install.packages(\"renv\", version = \"${renvVersion}\")" \
&& gdebi --non-interactive /tmp/r_amd64.deb \
&& rm -fr /tmp/r_amd64.deb \
&& ln -s /opt/R/${rVersion}/bin/R /usr/local/bin/R \
&& ln -s /opt/R/${rVersion}/bin/Rscript /usr/local/bin/Rscript \
&& R -e "options(repos = c(POSIT = \"https://packagemanager.posit.co/all/__linux__/jammy/latest\", CRAN = \"https://mirror.las.iastate.edu/CRAN\")); install.packages(\"renv\", version = \"${renvVersion}\")" \
# Install Trivy
&& curl -fsSL "https://github.com/aquasecurity/trivy/releases/download/v${trivyVersion}/trivy_${trivyVersion}_Linux-64bit.deb" -o /tmp/trivy.deb \
&& dpkg -i /tmp/trivy.deb \
&& rm -fr /tmp/trivy.deb \
&& dpkg -i /tmp/trivy.deb \
&& rm -fr /tmp/trivy.deb \
# Cleanup
&& apt-get -y autoclean \
&& apt-get -y autoremove \
Expand All @@ -124,7 +132,7 @@ RUN groupadd docker \
RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen \
&& locale-gen
ENV LANG=en_US.UTF-8 \
LC_ALL=en_US.UTF-8
LC_ALL=en_US.UTF-8

ARG user=vscode
RUN useradd -m $user \
Expand All @@ -151,8 +159,8 @@ RUN useradd -m $user \
# Install SonarScanner CLI
ARG SONAR_SCANNER_HOME=/opt/sonar-scanner
ENV SONAR_SCANNER_HOME=${SONAR_SCANNER_HOME} \
SONAR_USER_HOME=${SONAR_SCANNER_HOME}/.sonar \
PATH=${SONAR_SCANNER_HOME}/bin:${PATH}
SONAR_USER_HOME=${SONAR_SCANNER_HOME}/.sonar \
PATH=${SONAR_SCANNER_HOME}/bin:${PATH}
RUN curl https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${sonarScannerVersion}.zip --output sonar-scanner-cli.zip \
&& unzip sonar-scanner-cli.zip \
&& mv sonar-scanner-${sonarScannerVersion} ${SONAR_SCANNER_HOME} \
Expand Down

0 comments on commit bc24dc4

Please sign in to comment.