Skip to content

Instantly share code, notes, and snippets.

@jkeam
Last active July 13, 2021 19:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jkeam/eb91441a02229f4dac598635aedf0bb1 to your computer and use it in GitHub Desktop.
Save jkeam/eb91441a02229f4dac598635aedf0bb1 to your computer and use it in GitHub Desktop.
CodeReady Workspaces Devfile
apiVersion: 1.0.0
metadata:
name: spring-petclinic
projects:
- name: spring-petclinic
source:
location: 'http://gogs-demo-cicd.apps.bah.o1wf.p1.openshiftapps.com/gogs/spring-petclinic.git'
startPoint: master
type: git
components:
- id: redhat/java8/latest
type: chePlugin
- id: redhat/dependency-analytics/latest
type: chePlugin
- mountSources: true
endpoints:
- name: 8080-tcp
port: 8080
memoryLimit: 4G
type: dockerimage
volumes:
- name: m2
containerPath: /home/jboss/.m2
alias: maven
image: 'registry.redhat.io/codeready-workspaces/plugin-java8-rhel8@sha256:bb8ec9c4964e39b335be589f027c4b5ec866fe5f742c7181473e70fff717655d'
env:
- value: '-XX:MaxRAMPercentage=50.0 -XX:+UseParallelGC -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xms20m -Djava.security.egd=file:/dev/./urandom -Duser.home=/home/jboss'
name: JAVA_OPTS
- value: $(JAVA_OPTS)
name: MAVEN_OPTS
commands:
- name: 1. Build
actions:
- workdir: '${CHE_PROJECTS_ROOT}/spring-petclinic'
type: exec
command: 'MAVEN_OPTS="-Xmx1G" && mvn -Duser.home=${HOME} -DskipTests clean install'
component: maven
- name: 2. Run
actions:
- workdir: '${CHE_PROJECTS_ROOT}/spring-petclinic'
type: exec
command: 'MAVEN_OPTS="-Xmx1G" && mvn -Duser.home=${HOME} spring-boot:run'
component: maven
- name: 3. Run in debug mode
actions:
- workdir: '${CHE_PROJECTS_ROOT}/spring-petclinic'
type: exec
command: |-
mvn -Duser.home=${HOME} spring-boot:run -Dspring-boot.run.jvmArguments="-Xdebug
-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"
component: maven
- name: 4. Run tests
actions:
- workdir: '${CHE_PROJECTS_ROOT}/spring-petclinic'
type: exec
command: 'MAVEN_OPTS="-Xmx200m" && mvn -Duser.home=${HOME} verify'
component: maven
- name: 5. Log into deployment cluster
actions:
- workdir: '${CHE_PROJECTS_ROOT}/spring-petclinic'
type: exec
command: |
echo
echo "Before you can deploy this application to an openshift cluster,"
echo "you must run 'oc login ...' in the maven terminal."
echo
component: maven
- name: 6. Deploy to OpenShift
actions:
- workdir: '${CHE_PROJECTS_ROOT}/spring-petclinic'
type: exec
command: 'mvn fabric8:deploy -Popenshift -DskipTests'
component: maven
- name: Debug remote java application
actions:
- referenceContent: |
{
"version": "0.2.0",
"configurations": [
{
"type": "java",
"name": "Debug (Attach) - Remote",
"request": "attach",
"hostName": "localhost",
"port": 5005
}]
}
type: vscode-launch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment