67 lines
2.8 KiB
Markdown
67 lines
2.8 KiB
Markdown
# Introduction
|
|
|
|
This is a super simple API I created using Spring Boot/Gradle to showcase what a development workflow using Docker development containers looks like.
|
|
|
|
Once your editor or IDE finishes setting up this container, you can test out the API by navigating to [localhost:8080/sum](http://localhost:8080/sum). You will need to provide two integer parameters and, as the endpoint name suggests, the API will return their sum.
|
|
|
|
## Setup - VS Code
|
|
|
|
0. Ensure you have the following extension installed: `ms-vscode-remote.remote-containers` (copy-paste that into extension search).
|
|
|
|

|
|
|
|
1. It should be sufficient to simply open this project in VS Code.
|
|
|
|
|
|
## Setup - IntelliJ
|
|
|
|
1. In the welcome screen, navigate to Remote Development > Dev Containers.
|
|
|
|

|
|
|
|
2. Click on "New Dev Container" and either
|
|
|
|
a. Paste the link to this repository
|
|
|
|
b. Go to the "From Local Project" tab and give IDEA the path to this project's `devcontainer.json` file.
|
|
|
|
## Running the Application
|
|
|
|
To run the application, navigate to `CalculatorApplication.java` and click the run button in the top right, or go to the Spring Boot Dashboard and click the run button there.
|
|
|
|

|
|
|
|
|
|
### Example Usage
|
|
|
|
|
|
> http://localhost:8080/sum?num1=100&num2=12
|
|
|
|
|
|
will return 100 + 12 = 112.
|
|
|
|
# About Docker Devlopment Containers
|
|
|
|
Dev containers will allow our team to maintain a consistent development environment across members and platforms. While this is nice, it comes at the cost of (slightly) higher CPU, memory, and disk usage.
|
|
|
|
Both VS Code and IntelliJ IDEA support dev containers, with the former having a much higher level of integration. If we as a team enforce VS Code usage, we will see a greater level of consistency, as we will be able to declare what extensions get installed and what settings get modified.
|
|
|
|
> [!IMPORTANT]
|
|
> Cross IDE development is definitely possible, since IDEA (Ultimate) already comes bundled with everything VS Code would require an extension for.
|
|
|
|
## Disk Usage
|
|
|
|
In my testing, I've observed the following:
|
|
|
|
| VS Code | IDEA |
|
|
| -- | -- |
|
|
| ~600 MB | ~4 GB |
|
|
|
|
> [!WARNING]
|
|
> Please let me know if disk capacity is an issue for you and would make using a dev container not possible!
|
|
|
|
## Learn More
|
|
|
|
This video series is extremely informational and better explains what dev containers are and how they can be beneficial: [Beginner's Series to: Dev Containers](https://www.youtube.com/playlist?list=PLj6YeMhvp2S5G_X6ZyMc8gfXPMFPg3O31)
|
|
|
|
MS Learn also has a great module that relays the same information as the videos: [Use a Docker container as a development environment with Visual Studio Code](https://learn.microsoft.com/en-us/training/modules/use-docker-container-dev-env-vs-code/) |