Skip to content

Commit c66e0c4

Browse files
committed
Add Devbox example
1 parent dc6c26d commit c66e0c4

File tree

15 files changed

+766
-0
lines changed

15 files changed

+766
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM jetpackio/devbox:0.16.0
2+
3+
WORKDIR /code
4+
USER root:root
5+
RUN mkdir -p /code && chown ${DEVBOX_USER}:${DEVBOX_USER} /code
6+
7+
USER ${DEVBOX_USER}:${DEVBOX_USER}
8+
COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} devbox.json devbox.json
9+
COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} devbox.lock devbox.lock
10+
11+
RUN devbox run -- echo "Installed Packages." && nix-store --gc && nix-store --optimise
12+
13+
RUN devbox shellenv --init-hook >> ~/.profile
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"name": "Java",
3+
4+
"build": {
5+
"dockerfile": "./Dockerfile",
6+
"context": ".."
7+
},
8+
9+
"customizations": {
10+
"vscode": {
11+
"settings": {},
12+
"extensions": [
13+
// Extension Pack for Java
14+
"vscjava.vscode-java-pack",
15+
// Spring Boot Extension Pack
16+
"vmware.vscode-boot-dev-pack",
17+
18+
// YAML
19+
"redhat.vscode-yaml",
20+
21+
// Excluding the Gradle extension as it breaks the Spring Boot DevTools
22+
"-vscjava.vscode-gradle",
23+
// Excluding the Container extensions. Not needed + heavyweight.
24+
"-ms-azuretools.vscode-containers",
25+
"-ms-azuretools.vscode-docker"
26+
]
27+
}
28+
},
29+
30+
"forwardPorts": [
31+
8080
32+
],
33+
34+
"otherPortsAttributes": {
35+
"onAutoForward": "ignore"
36+
},
37+
38+
"mounts": [
39+
// Gradle cache
40+
"source=${localEnv:HOME}/.gradle,target=/home/devbox/.gradle,type=bind,consistency=cached",
41+
// Maven cache
42+
"source=${localEnv:HOME}/.m2,target=/home/devbox/.m2,type=bind,consistency=cached",
43+
],
44+
45+
"postCreateCommand": "java -version",
46+
47+
"remoteUser": "devbox",
48+
49+
"waitFor": "postCreateCommand"
50+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
HELP.md
2+
.gradle
3+
build/
4+
!gradle/wrapper/gradle-wrapper.jar
5+
!**/src/main/**/build/
6+
!**/src/test/**/build/
7+
8+
### STS ###
9+
.apt_generated
10+
.classpath
11+
.factorypath
12+
.project
13+
.settings
14+
.springBeans
15+
.sts4-cache
16+
bin/
17+
!**/src/main/**/bin/
18+
!**/src/test/**/bin/
19+
20+
### IntelliJ IDEA ###
21+
.idea
22+
*.iws
23+
*.iml
24+
*.ipr
25+
out/
26+
!**/src/main/**/out/
27+
!**/src/test/**/out/
28+
29+
### NetBeans ###
30+
/nbproject/private/
31+
/nbbuild/
32+
/dist/
33+
/nbdist/
34+
/.nb-gradle/
35+
36+
### VS Code ###
37+
.vscode/
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Development Environment: Devbox
2+
3+
With [Devbox](https://www.jetify.com/devbox) you can create "isolated, reproducible development environments that run anywhere.".
4+
5+
## Install Devbox
6+
7+
Follow the [instructions](https://www.jetify.com/docs/devbox/installing_devbox/) to install Devbox on your machine.
8+
9+
## Activate Environment
10+
11+
Navigate to this folder and activate the development environment with Devbox:
12+
13+
```shell
14+
devbox shell
15+
```
16+
17+
You're now working inside your brand new development environment!
18+
19+
## Use Environment
20+
21+
The development environment for this project installs and configures Java 24, the Arconia CLI, and httpie. All those packages are dedicated to this environment.
22+
23+
For example, you can verify that the Arconia CLI is part of the environment and not installed globally:
24+
25+
```shell
26+
which arconia
27+
```
28+
29+
Go ahead and run the Spring Boot application in development mode:
30+
31+
```shell
32+
arconia dev
33+
```
34+
35+
When you're done working with this environment, you can exit by running this command:
36+
37+
```shell
38+
exit
39+
```
40+
41+
## Visual Studio Code
42+
43+
After activating the environment with Flox, you can open the project with Visual Studio Code, which will run in the context of your environment:
44+
45+
```shell
46+
code .
47+
```
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
plugins {
2+
id 'java'
3+
id 'eclipse'
4+
id 'org.springframework.boot' version '3.5.5'
5+
id 'io.spring.dependency-management' version '1.1.7'
6+
}
7+
8+
group = 'com.thomasvitale'
9+
version = '0.0.1-SNAPSHOT'
10+
11+
java {
12+
toolchain {
13+
languageVersion = JavaLanguageVersion.of(24)
14+
}
15+
}
16+
17+
repositories {
18+
mavenCentral()
19+
}
20+
21+
dependencies {
22+
implementation 'org.springframework.boot:spring-boot-starter-actuator'
23+
implementation 'org.springframework.boot:spring-boot-starter-web'
24+
25+
developmentOnly 'org.springframework.boot:spring-boot-devtools'
26+
27+
testImplementation 'org.springframework.boot:spring-boot-starter-test'
28+
testImplementation 'org.springframework:spring-webflux'
29+
}
30+
31+
eclipse {
32+
classpath {
33+
baseSourceOutputDir = file('build/classes/java')
34+
}
35+
}
36+
37+
tasks.named('test') {
38+
useJUnitPlatform()
39+
}
40+
41+
tasks.named('bootBuildImage') {
42+
builder = "docker.io/paketobuildpacks/builder-noble-java-tiny"
43+
imageName = "demo"
44+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/jetify-com/devbox/0.16.0/.schema/devbox.schema.json",
3+
"packages": [
4+
"httpie@latest",
5+
"zulu24@latest",
6+
"github:thomasvitale/arconia-cli-flake"
7+
],
8+
"shell": {
9+
"init_hook": [
10+
"echo 'Welcome to devbox!' > /dev/null"
11+
],
12+
"scripts": {
13+
"test": [
14+
"echo \"Error: no test specified\" && exit 1"
15+
]
16+
}
17+
}
18+
}
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
{
2+
"lockfile_version": "1",
3+
"packages": {
4+
"github:NixOS/nixpkgs/nixpkgs-unstable": {
5+
"last_modified": "2025-09-01T03:15:32Z",
6+
"resolved": "github:NixOS/nixpkgs/58dcbf1ec551914c3756c267b8b9c8c86baa1b2f?lastModified=1756696532&narHash=sha256-6FWagzm0b7I%2FIGigOv9pr6LL7NQ86mextfE8g8Q6HBg%3D"
7+
},
8+
"github:thomasvitale/arconia-cli-flake": {
9+
"last_modified": "2025-08-12T19:32:43Z",
10+
"resolved": "github:thomasvitale/arconia-cli-flake/a828dee66508fbdcab54824710a45bed126f8388?lastModified=1755027163&narHash=sha256-e3xemUu3swcekn4ZdnjccKKUl2jxoAZ5d9HqzEtr0fI%3D"
11+
},
12+
"httpie@latest": {
13+
"last_modified": "2025-07-28T17:09:23Z",
14+
"resolved": "github:NixOS/nixpkgs/648f70160c03151bc2121d179291337ad6bc564b#httpie",
15+
"source": "devbox-search",
16+
"version": "3.2.4",
17+
"systems": {
18+
"aarch64-darwin": {
19+
"outputs": [
20+
{
21+
"name": "out",
22+
"path": "/nix/store/xr231p4q6sib62ya06dmal5mqkx3mw71-python3.13-httpie-3.2.4",
23+
"default": true
24+
},
25+
{
26+
"name": "dist",
27+
"path": "/nix/store/35fl1gb4kb5952vnz61rg73dkq380442-python3.13-httpie-3.2.4-dist"
28+
}
29+
],
30+
"store_path": "/nix/store/xr231p4q6sib62ya06dmal5mqkx3mw71-python3.13-httpie-3.2.4"
31+
},
32+
"aarch64-linux": {
33+
"outputs": [
34+
{
35+
"name": "out",
36+
"path": "/nix/store/cgw4gimr0im69ffsdyqryssq5zr86npa-python3.13-httpie-3.2.4",
37+
"default": true
38+
},
39+
{
40+
"name": "dist",
41+
"path": "/nix/store/f49v94sdzwwm6ibhggkrpxvi3yg0ari9-python3.13-httpie-3.2.4-dist"
42+
}
43+
],
44+
"store_path": "/nix/store/cgw4gimr0im69ffsdyqryssq5zr86npa-python3.13-httpie-3.2.4"
45+
},
46+
"x86_64-darwin": {
47+
"outputs": [
48+
{
49+
"name": "out",
50+
"path": "/nix/store/ymzvbkq13cf45sdzfsvdnx1rm0d9d8hx-python3.13-httpie-3.2.4",
51+
"default": true
52+
},
53+
{
54+
"name": "dist",
55+
"path": "/nix/store/lgi3zh376dbr2iawhhd8hw958cdsmpbw-python3.13-httpie-3.2.4-dist"
56+
}
57+
],
58+
"store_path": "/nix/store/ymzvbkq13cf45sdzfsvdnx1rm0d9d8hx-python3.13-httpie-3.2.4"
59+
},
60+
"x86_64-linux": {
61+
"outputs": [
62+
{
63+
"name": "out",
64+
"path": "/nix/store/5cc08zz45zfrl0ka58abjcp8hwhib7zp-python3.13-httpie-3.2.4",
65+
"default": true
66+
},
67+
{
68+
"name": "dist",
69+
"path": "/nix/store/0rz883gyx30ggxkh51dsqw0px0dxmj30-python3.13-httpie-3.2.4-dist"
70+
}
71+
],
72+
"store_path": "/nix/store/5cc08zz45zfrl0ka58abjcp8hwhib7zp-python3.13-httpie-3.2.4"
73+
}
74+
}
75+
},
76+
"zulu24@latest": {
77+
"last_modified": "2025-07-28T17:09:23Z",
78+
"resolved": "github:NixOS/nixpkgs/648f70160c03151bc2121d179291337ad6bc564b#zulu24",
79+
"source": "devbox-search",
80+
"version": "24.0.1",
81+
"systems": {
82+
"aarch64-darwin": {
83+
"outputs": [
84+
{
85+
"name": "out",
86+
"path": "/nix/store/vfvi6zkyv2m3hlh0chpyzkddk18sgha7-zulu-ca-jdk-24.0.1",
87+
"default": true
88+
}
89+
],
90+
"store_path": "/nix/store/vfvi6zkyv2m3hlh0chpyzkddk18sgha7-zulu-ca-jdk-24.0.1"
91+
},
92+
"aarch64-linux": {
93+
"outputs": [
94+
{
95+
"name": "out",
96+
"path": "/nix/store/9lfz8z8ywliv80fv12bq26ja3i2x92k3-zulu-ca-jdk-24.0.1",
97+
"default": true
98+
}
99+
],
100+
"store_path": "/nix/store/9lfz8z8ywliv80fv12bq26ja3i2x92k3-zulu-ca-jdk-24.0.1"
101+
},
102+
"x86_64-darwin": {
103+
"outputs": [
104+
{
105+
"name": "out",
106+
"path": "/nix/store/k9vixhcx24fdmr2z8hwzw0al9b08fplr-zulu-ca-jdk-24.0.1",
107+
"default": true
108+
}
109+
],
110+
"store_path": "/nix/store/k9vixhcx24fdmr2z8hwzw0al9b08fplr-zulu-ca-jdk-24.0.1"
111+
},
112+
"x86_64-linux": {
113+
"outputs": [
114+
{
115+
"name": "out",
116+
"path": "/nix/store/cnvc2gsrq420apv1w3y8s3mcxarg0xly-zulu-ca-jdk-24.0.1",
117+
"default": true
118+
}
119+
],
120+
"store_path": "/nix/store/cnvc2gsrq420apv1w3y8s3mcxarg0xly-zulu-ca-jdk-24.0.1"
121+
}
122+
}
123+
}
124+
}
125+
}
Binary file not shown.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionSha256Sum=7197a12f450794931532469d4ff21a59ea2c1cd59a3ec3f89c035c3c420a6999
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-bin.zip
5+
networkTimeout=10000
6+
validateDistributionUrl=true
7+
zipStoreBase=GRADLE_USER_HOME
8+
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)