-
Notifications
You must be signed in to change notification settings - Fork 160
feat: added devcontainers #10866
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
norton120
wants to merge
6
commits into
projectnessie:main
Choose a base branch
from
pirate-baby:devcontainer
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat: added devcontainers #10866
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
839b9bd
feat: add development container configuration
norton120 f23e772
docs: add development container section to CONTRIBUTING.md
norton120 58a2a64
cleaned up doc contributions
norton120 09cc73b
fix: restore original trailing whitespace in CONTRIBUTING.md
norton120 09da8b2
add CLAUDE file
norton120 2db7d6b
added workflow for CI to test devcontainer (basic env spinup only so …
norton120 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Nessie Development Container | ||
# Based on the project's requirements and existing Docker setup | ||
|
||
FROM openjdk:21-jdk-slim | ||
|
||
LABEL org.opencontainers.image.source=https://github.com/pirate-baby/nessie | ||
LABEL org.opencontainers.image.description="Nessie Development Container" | ||
LABEL org.opencontainers.image.licenses=Apache-2.0 | ||
|
||
# Set environment variables | ||
ENV LANGUAGE='en_US:en' | ||
ENV JAVA_HOME=/usr/local/openjdk-21 | ||
ENV PATH="${JAVA_HOME}/bin:${PATH}" | ||
|
||
# Install development tools and dependencies | ||
USER root | ||
|
||
# Update packages and install development essentials | ||
RUN apt-get update && \ | ||
apt-get install -y \ | ||
git \ | ||
curl \ | ||
wget \ | ||
findutils \ | ||
tar \ | ||
gzip \ | ||
unzip \ | ||
procps \ | ||
sudo \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Install Docker CLI (for potential Docker-in-Docker scenarios) | ||
RUN curl -fsSL https://download.docker.com/linux/static/stable/x86_64/docker-24.0.7.tgz | \ | ||
tar -xz -C /tmp && \ | ||
mv /tmp/docker/docker /usr/local/bin/ && \ | ||
rm -rf /tmp/docker | ||
|
||
# Create nessie user for development (matching project's pattern) | ||
RUN groupadd --gid 10001 nessie && \ | ||
useradd --uid 10000 --gid nessie --create-home --shell /bin/bash nessie && \ | ||
usermod -aG sudo nessie && \ | ||
echo "nessie ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers | ||
|
||
# Set up workspace directory | ||
RUN mkdir -p /workspace && \ | ||
chown -R nessie:nessie /workspace | ||
|
||
# Switch to nessie user | ||
USER nessie | ||
WORKDIR /workspace | ||
|
||
# Set user environment | ||
ENV USER=nessie | ||
ENV UID=10000 | ||
ENV HOME=/home/nessie | ||
|
||
# Verify Java installation | ||
RUN java --version && javac --version | ||
|
||
# Set the default command | ||
CMD ["/bin/bash"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
# Nessie Development Container | ||
|
||
This directory contains a development container configuration for Project Nessie that provides a consistent, containerized development environment with all necessary tools pre-installed. | ||
|
||
## What's Included | ||
|
||
- **Java 21 JDK** - Full OpenJDK development environment | ||
- **Gradle** - Build tool (downloaded automatically via wrapper) | ||
- **Git** - Version control | ||
- **Docker CLI** - For container operations | ||
- **Development tools** - curl, wget, unzip, and other essentials | ||
- **VS Code extensions** - Java development pack, Gradle support | ||
- **User setup** - Non-root `nessie` user with sudo access | ||
|
||
## Quick Start | ||
|
||
### Option 1: VS Code Dev Containers (Recommended) | ||
|
||
1. Install the [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) | ||
2. Open the project in VS Code | ||
3. When prompted, click "Reopen in Container" or use `Ctrl+Shift+P` → "Dev Containers: Reopen in Container" | ||
4. Wait for the container to build and start | ||
|
||
### Option 2: Manual Docker Usage | ||
|
||
```bash | ||
# Build the development container | ||
docker build -f .devcontainer/Dockerfile -t nessie-dev . | ||
norton120 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# Run a shell in the container | ||
docker run -it --rm -v $(pwd):/workspace -w /workspace nessie-dev bash | ||
|
||
# Test the setup | ||
./gradlew --version | ||
java --version | ||
``` | ||
|
||
## Development Workflow | ||
|
||
Once in the container, you can use all the standard Nessie development commands: | ||
|
||
```bash | ||
# Basic smoke test | ||
./gradlew sAp compileAll jar codeChecks | ||
|
||
# Run tests | ||
./gradlew test | ||
|
||
# Run integration tests | ||
./gradlew intTest | ||
|
||
# Build and run the server | ||
./gradlew :nessie-quarkus:quarkusBuild | ||
java -jar servers/quarkus-server/build/quarkus-app/quarkus-run.jar | ||
``` | ||
|
||
The Nessie server will be available at http://localhost:19120 (automatically forwarded in VS Code). | ||
|
||
## Why Use This Dev Container? | ||
|
||
This addresses the common issues mentioned in Nessie's contributing docs: | ||
|
||
- ✅ **No "development on the metal"** - Everything runs in a safe, isolated container | ||
- ✅ **Linux-first environment** - Even on macOS/Windows, you get a consistent Linux environment | ||
- ✅ **No Podman conflicts** - Uses Docker with a standard Debian base | ||
- ✅ **Pre-configured toolchain** - Java 21, Gradle, and all dependencies ready to go | ||
- ✅ **VS Code integration** - Full IDE support with proper Java language server setup | ||
|
||
## Container Details | ||
|
||
- **Base Image**: `openjdk:21-jdk-slim` (Debian-based) | ||
- **User**: `nessie` (UID 10000, GID 10001) | ||
- **Working Directory**: `/workspace` | ||
- **Port Forwarding**: 19120 (Nessie server) | ||
- **Java Home**: `/usr/local/openjdk-21` | ||
|
||
## Customization | ||
|
||
You can modify the configuration by editing: | ||
- `.devcontainer/devcontainer.json` - VS Code settings, extensions, port forwarding | ||
- `.devcontainer/Dockerfile` - Container image, installed packages, environment | ||
|
||
## Troubleshooting | ||
|
||
**Container won't start**: Ensure Docker is running and you have sufficient disk space. | ||
|
||
**Gradle issues**: The container automatically downloads Gradle via the wrapper. Make sure you have network access. | ||
|
||
**Permission errors**: The container runs as user `nessie` with sudo access. Files should be automatically owned correctly. | ||
|
||
**VS Code Java issues**: The container includes proper Java language server configuration. Reload VS Code if needed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{ | ||
"name": "Nessie Development", | ||
"build": { | ||
"dockerfile": "Dockerfile", | ||
"context": "." | ||
}, | ||
"features": { | ||
"ghcr.io/devcontainers/features/git:1": {}, | ||
"ghcr.io/devcontainers/features/github-cli:1": {} | ||
}, | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"vscjava.vscode-java-pack", | ||
"redhat.java", | ||
"vscjava.vscode-gradle", | ||
"ms-vscode.vscode-json", | ||
"streetsidesoftware.code-spell-checker" | ||
], | ||
"settings": { | ||
"java.configuration.runtimes": [ | ||
{ | ||
"name": "JavaSE-21", | ||
"path": "/usr/local/openjdk-21" | ||
} | ||
], | ||
"java.compile.nullAnalysis.mode": "automatic" | ||
} | ||
} | ||
}, | ||
"containerEnv": { | ||
"JAVA_HOME": "/usr/local/openjdk-21" | ||
}, | ||
"remoteUser": "nessie", | ||
"workspaceFolder": "/workspace", | ||
"mounts": [ | ||
"source=${localWorkspaceFolder},target=/workspace,type=bind,consistency=cached" | ||
], | ||
"forwardPorts": [19120], | ||
"portsAttributes": { | ||
"19120": { | ||
"label": "Nessie Server", | ||
"onAutoForward": "notify" | ||
} | ||
}, | ||
"postCreateCommand": "./gradlew --version", | ||
"remoteEnv": { | ||
"PATH": "${containerEnv:PATH}:/usr/local/openjdk-21/bin" | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.