-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add devcontainers for enabling github codespaces usage. (#2605)
* feat: add devcontainers for enabling github codespaces usage. * fix: enable intallation of maven. * fix: add postCreateCommand script. * fix:upgrade to Java 11 to fix build errors in container builds. * chore: add 'clean' in the postCreate script. * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * fix: review comments. --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
- Loading branch information
1 parent
ac762fb
commit a7d60f1
Showing
3 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Reference - https://github.com/microsoft/vscode-dev-containers/tree/main/containers/java-8/.devcontainer | ||
# [Choice] Debian OS version (use bullseye on local arm64/Apple Silicon): buster, bullseye | ||
# [Choice] Java version (use -bullseye variants on local arm64/Apple Silicon): 11, 17, 11-bullseye, 17-bullseye, 11-buster, 17-buster | ||
ARG VARIANT="bullseye" | ||
FROM mcr.microsoft.com/vscode/devcontainers/java:11-${VARIANT} | ||
|
||
# [Option] Install Maven | ||
ARG INSTALL_MAVEN="true" | ||
ARG MAVEN_VERSION="" | ||
# [Option] Install Gradle | ||
ARG INSTALL_GRADLE="false" | ||
ARG GRADLE_VERSION="" | ||
RUN if [ "${INSTALL_MAVEN}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/sdkman/bin/sdkman-init.sh && sdk install maven \"${MAVEN_VERSION}\""; fi \ | ||
&& if [ "${INSTALL_GRADLE}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/sdkman/bin/sdkman-init.sh && sdk install gradle \"${GRADLE_VERSION}\""; fi | ||
|
||
# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10 | ||
ARG NODE_VERSION="lts/*" | ||
RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi | ||
|
||
# install gloud sdk | ||
RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list && curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - && apt-get update -y && apt-get install google-cloud-cli -y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{ | ||
"name": "Java 11", | ||
"build": { | ||
"dockerfile": "Dockerfile", | ||
"args": { | ||
// Use the VARIANT arg to pick a Debian OS version: buster, bullseye | ||
// Use bullseye when running on local arm64/Apple Silicon. | ||
"VARIANT": "bullseye", | ||
// Options | ||
"INSTALL_MAVEN": "true", | ||
"INSTALL_GRADLE": "false", | ||
"NODE_VERSION": "lts/*" | ||
} | ||
}, | ||
|
||
// Configure tool-specific properties. | ||
"customizations": { | ||
// Configure properties specific to VS Code. | ||
"vscode": { | ||
// Set *default* container specific settings.json values on container create. | ||
"settings": { | ||
"java.import.gradle.java.home": "/usr/local/sdkman/candidates/java/current", | ||
"java.configuration.runtimes": [{ | ||
"default": true, | ||
"name": "JavaSE-11", | ||
"path": "/usr/local/sdkman/candidates/java/current" | ||
}] | ||
}, | ||
|
||
// Add the IDs of extensions you want installed when the container is created. | ||
"extensions": [ | ||
"vscjava.vscode-java-pack", | ||
"ms-azuretools.vscode-docker" | ||
] | ||
} | ||
}, | ||
|
||
// Use 'postCreateCommand' to run commands after the container is created. | ||
"postCreateCommand": "bash .devcontainer/postCreate.sh", | ||
|
||
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. | ||
"remoteUser": "vscode" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
echo "Post Create Starting" | ||
|
||
mvn clean install -B -V -ntp \ | ||
-DskipTests=true \ | ||
-Dmaven.javadoc.skip=true \ | ||
-Dclirr.skip=true |