Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
FROM openjdk:21-jdk-slim

LABEL org.opencontainers.image.source=https://github.com/projectnessie/nessie
LABEL org.opencontainers.image.description="Nessie Development Container"
LABEL org.opencontainers.image.licenses=Apache-2.0

ENV LANGUAGE='en_US:en'
ENV JAVA_HOME=/usr/local/openjdk-21
ENV PATH="${JAVA_HOME}/bin:${PATH}"

# note "invalid signature encountered" is a common error when out of disk space or no internet
RUN apt-get update && \
apt-get install -y \
git \
curl \
wget \
findutils \
tar \
gzip \
unzip \
procps && \
rm -rf /var/lib/apt/lists/*

# will need docker/podman
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

USER nessie
WORKDIR /workspace

# verify
RUN java --version && javac --version
CMD ["/bin/bash"]
57 changes: 57 additions & 0 deletions .devcontainer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# 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 .

# Run a shell in the container
docker run -it --rm -v $(pwd):/workspace -w /workspace nessie-dev /bin/bash

# Test the setup
./gradlew --version
java --version
```

## Development Workflow

Once in the container, you can use all the standard Nessie [development commands](../CONTRIBUTING.md):

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


## Troubleshooting

**Container build fails with "At least one invalid signature was encountered."**: You are likely out of disk space (in docker at least), or you have no network connection. Clean out unused containers and images, and try again.
49 changes: 49 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"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"
],
"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"
}
}
28 changes: 28 additions & 0 deletions .github/workflows/devcontainer-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Devcontainer Build Test

on:
pull_request:
# we could be more aggressive with this check, but I also don't want to double dip tests and the rest of CI
paths:
- '.devcontainer/**'

jobs:
build-devcontainer:
name: Build and Test Devcontainer
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Build devcontainer image
run: |
docker build -t nessie-devcontainer -f .devcontainer/Dockerfile .

- name: Run gradle build in devcontainer
run: |
docker run --rm \
-v "$(pwd)":/workspace \
-w /workspace \
-u nessie \
nessie-devcontainer \
./gradlew jar testClasses
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,6 @@ __pycache__/

# Spark / Hive
metastore_db/

# Claude AI assistant files
CLAUDE.md
13 changes: 13 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,19 @@ non-obvious platform differences.

TL;DR It is fine to build code on macOS and Windows, but the reference platform is Linux.

#### Development Container

If you prefer not to develop on the metal, Nessie provides a VSCode `devcontainers` development container
configuration that creates an isolated Linux environment with all required tools pre-installed.

**Quick Start:**
(Assumes you are using [VS Code](https://code.visualstudio.com/) with the [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) )
1. Open the project in VS Code
2. When prompted, click "Reopen in Container" or use `Ctrl+Shift+P` → "Dev Containers: Reopen in Container"
3. Wait for the container to build and start developing!

For detailed instructions and manual Docker usage, see [`.devcontainer/README.md`](.devcontainer/README.md).

#### Running tests on macOS

In our CI we use Podman for macOS, initialized using the following sequence of commands,
Expand Down