|
| 1 | +version: v1beta10 |
| 2 | + |
| 3 | +# `images` specifies all images that may need to be built for this project |
| 4 | +images: |
| 5 | + app: # This image is called `app` and this name `app` is referenced multiple times in the config below |
| 6 | + image: joaomlneto/example-devspace-spring-boot |
| 7 | + dockerfile: ./Dockerfile |
| 8 | + injectRestartHelper: true |
| 9 | + appendDockerfileInstructions: |
| 10 | + - USER root |
| 11 | + rebuildStrategy: ignoreContextChanges |
| 12 | + build: |
| 13 | + docker: |
| 14 | + options: |
| 15 | + target: build |
| 16 | + |
| 17 | +# `deployments` tells DevSpace how to deploy this project |
| 18 | +deployments: |
| 19 | +- name: example-devspace-spring-boot |
| 20 | + # This deployment uses `helm` but you can also define `kubectl` deployments or kustomizations |
| 21 | + helm: |
| 22 | + # We are deploying the so-called Component Chart: https://devspace.sh/component-chart/docs |
| 23 | + componentChart: true |
| 24 | + # Under `values` we can define the values for this Helm chart used during `helm install/upgrade` |
| 25 | + # You may also use `valuesFiles` to load values from files, e.g. valuesFiles: ["values.yaml"] |
| 26 | + values: |
| 27 | + containers: |
| 28 | + - image: image(app):tag(app) # Use the `app` image (see `images`) and the tag DevSpace generates during image building in your Helm values |
| 29 | + service: |
| 30 | + ports: |
| 31 | + - port: 8080 |
| 32 | + |
| 33 | +# `dev` only applies when you run `devspace dev` |
| 34 | +dev: |
| 35 | + # `dev.ports` specifies all ports that should be forwarded while `devspace dev` is running |
| 36 | + # Port-forwarding lets you access your application via localhost on your local machine |
| 37 | + ports: |
| 38 | + - imageName: app # Select the Pod that runs our `app` image |
| 39 | + forward: |
| 40 | + - port: 8080 |
| 41 | + |
| 42 | + # `dev.open` tells DevSpace to open certain URLs as soon as they return HTTP status 200 |
| 43 | + # Since we configured port-forwarding, we can use a localhost address here to access our application |
| 44 | + open: |
| 45 | + - url: http://localhost:8080 |
| 46 | + |
| 47 | + # `dev.sync` configures a file sync between our Pods in k8s and your local project files |
| 48 | + sync: |
| 49 | + - imageName: app # Select the Pod that runs our `app` image |
| 50 | + #disableDownload: true |
| 51 | + excludePaths: |
| 52 | + - .git/ |
| 53 | + uploadExcludePaths: |
| 54 | + - Dockerfile |
| 55 | + - target/ |
| 56 | + waitInitialSync: false |
| 57 | + # XXX ATTENTION! This is a change from the defaults XXX |
| 58 | + # Since Spring Boot devtools automatically reloads classes that were changed, instead of restarting |
| 59 | + # the container, we simply have to recompile the classes! |
| 60 | + onUpload: |
| 61 | + execRemote: |
| 62 | + command: mvn |
| 63 | + args: |
| 64 | + - compile |
| 65 | + |
| 66 | + # `dev.terminal` tells DevSpace to open a terminal as a last step during `devspace dev` |
| 67 | + terminal: |
| 68 | + imageName: app |
| 69 | + # With this optional `command` we can tell DevSpace to run a script when opening the terminal |
| 70 | + # This is often useful to display help info for new users or perform initial tasks (e.g. installing dependencies) |
| 71 | + # DevSpace has generated an example ./devspace_start.sh file in your local project - Feel free to customize it! |
| 72 | + command: |
| 73 | + - ./devspace_start.sh |
| 74 | + |
| 75 | +# `profiles` lets you modify the config above for different environments (e.g. dev vs production) |
| 76 | +profiles: |
| 77 | + # This profile is called `production` and you can use it for example using: devspace deploy -p production |
| 78 | + # We generally recommend to use the base config without any profiles as optimized for development (e.g. image build+push is disabled) |
| 79 | +- name: production |
| 80 | + # This profile applies patches to the config above. |
| 81 | + # In this case, it enables image building for example by removing the `disabled: true` statement for the image `app` |
| 82 | + patches: |
| 83 | + - op: remove |
| 84 | + path: images.app.build.docker.options.target |
0 commit comments