Go to file
2024-06-13 21:30:33 -07:00
.devcontainer Initial commit 2024-06-13 21:30:33 -07:00
.github Initial commit 2024-06-13 21:30:33 -07:00
gradle/wrapper Initial commit 2024-06-13 21:30:33 -07:00
resources Initial commit 2024-06-13 21:30:33 -07:00
src Initial commit 2024-06-13 21:30:33 -07:00
.gitignore Initial commit 2024-06-13 21:30:33 -07:00
build.gradle Initial commit 2024-06-13 21:30:33 -07:00
gradlew Initial commit 2024-06-13 21:30:33 -07:00
gradlew.bat Initial commit 2024-06-13 21:30:33 -07:00
readme.md Initial commit 2024-06-13 21:30:33 -07:00
settings.gradle Initial commit 2024-06-13 21:30:33 -07:00

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. You will need to provide two integer parameters and, as the endpoint name suggests, the API will return their sum.

Setup - VS Code

  1. 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.

  1. 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

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