From abee85939f13bae95c28669acb6ce973943ea574 Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Wed, 8 Jun 2022 13:04:08 +0000 Subject: [PATCH] Add devcontainer and gitpod Also works in codespaces. --- .devcontainer/Dockerfile | 5 +++++ .devcontainer/devcontainer.json | 25 +++++++++++++++++++++++++ .gitignore | 1 + .gitpod.yml | 9 +++++++++ readme.md | 2 ++ 5 files changed, 42 insertions(+) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json create mode 100644 .gitpod.yml diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..5213592 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,5 @@ +ARG VARIANT=11-bullseye +FROM mcr.microsoft.com/vscode/devcontainers/java:0-${VARIANT} + +ARG NODE_VERSION="none" +RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..a76c535 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,25 @@ +{ + "name": "Petclinic", + "dockerFile": "Dockerfile", + + "customizations": { + "vscode": { + "extensions": [ + "vscjava.vscode-java-pack", + "redhat.vscode-xml" + ] + } + }, + "runArgs": [ + "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined", + "--mount", "type=bind,source=${env:HOME}/.m2,target=/home/vscode/.m2", + "--mount", "type=bind,source=${env:HOME}/.gradle,target=/home/vscode/.gradle" + ], + + "initializeCommand": "mkdir -p ${env:HOME}/.m2 ${env:HOME}/.gradle", + "onCreateCommand": "sudo chown vscode:vscode /home/vscode/.m2 /home/vscode/.gradle", + "remoteUser": "vscode", + "features": { + "docker-in-docker": "latest" + } +} diff --git a/.gitignore b/.gitignore index cb16716..af0cb9b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ target/* +bin/* build/* .gradle/* .settings/* diff --git a/.gitpod.yml b/.gitpod.yml new file mode 100644 index 0000000..8b3bb72 --- /dev/null +++ b/.gitpod.yml @@ -0,0 +1,9 @@ +image: + file: ./.devcontainer/Dockerfile +tasks: + - before: sudo usermod -a -G sdkman gitpod && sudo usermod -a -G nvm gitpod && sudo chown -R gitpod /usr/local/sdkman /usr/local/share/nvm + - init: ./mvnw install +vscode: + extensions: + - vscjava.vscode-java-pack + - redhat.vscode-xml \ No newline at end of file diff --git a/readme.md b/readme.md index 64eeb8c..c610b92 100644 --- a/readme.md +++ b/readme.md @@ -1,5 +1,7 @@ # Spring PetClinic Sample Application [![Build Status](https://github.com/spring-projects/spring-petclinic/actions/workflows/maven-build.yml/badge.svg)](https://github.com/spring-projects/spring-petclinic/actions/workflows/maven-build.yml) +[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/spring-projects/spring-petclinic) + ## Understanding the Spring Petclinic application with a few diagrams See the presentation here