From 999baabc6493544bd972f3b979a97619214b23fb Mon Sep 17 00:00:00 2001 From: Daniel Bengl Date: Wed, 24 Sep 2025 15:35:50 +0200 Subject: [PATCH] Implement dockerfile --- Brewfile | 38 +++++++++++++++++++++++ DOCKER_README.md | 77 ++++++++++++++++++++++++++++++++++++++++++++++ Dockerfile | 70 +++++++++++++++++++++++++++++++++++++++++ docker-compose.yml | 18 +++++++++++ 4 files changed, 203 insertions(+) create mode 100644 Brewfile create mode 100644 DOCKER_README.md create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/Brewfile b/Brewfile new file mode 100644 index 0000000..95c61b7 --- /dev/null +++ b/Brewfile @@ -0,0 +1,38 @@ +# Core tools +brew "git" +brew "neovim" +brew "curl" +brew "wget" + +# Language version managers +brew "mise" + +# Development tools +brew "ruby-build" # Needed for mise to install Ruby +brew "openssl@3" # Dependency for ruby-build +brew "libyaml" # Dependency for ruby-build +brew "libffi" # Dependency for ruby-build + +# Search and file tools (commonly used with nvim) +brew "ripgrep" # rg - fast grep alternative +brew "fd" # fd - fast find alternative +brew "fzf" # fuzzy finder +brew "bat" # cat with syntax highlighting +brew "tree" # directory tree viewer + +# Git tools +brew "lazygit" # Git TUI + +# Terminal multiplexer +brew "tmux" # Terminal multiplexer +brew "zellij" # Modern terminal workspace + +# LSP and formatters that might be needed +brew "lua-language-server" +brew "stylua" # Lua formatter + +# Additional utilities +brew "jq" # JSON processor +brew "yq" # YAML processor +brew "htop" # Process viewer +brew "watch" # Execute command repeatedly \ No newline at end of file diff --git a/DOCKER_README.md b/DOCKER_README.md new file mode 100644 index 0000000..c7c9f25 --- /dev/null +++ b/DOCKER_README.md @@ -0,0 +1,77 @@ +# Neovim Docker Setup + +## Quick Start + +### Build and Run + +```bash +# Build the image +docker build -t nvim-dotfiles . + +# Run interactively +docker run -it --rm -v $(pwd):/workspace nvim-dotfiles + +# Or use docker-compose +docker-compose up -d +docker-compose exec nvim bash +``` + +### Usage Examples + +```bash +# Start Neovim +nvim + +# Check health +nvim --headless +checkhealth +qall + +# Use Ruby/Node with mise +eval "$(mise activate bash)" +ruby --version +node --version + +# Run project commands +bundle install # Ruby projects +npm install # Node projects +``` + +## Development Workflow + +1. **Start the container:** + ```bash + docker-compose up -d + docker-compose exec nvim bash + ``` + +2. **Your dotfiles are available** at `/home/developer/.dotfiles` + +3. **Work on projects** by mounting them: + ```bash + docker run -it --rm -v /path/to/project:/workspace nvim-dotfiles + ``` + +4. **Persistent data** is kept in Docker volumes for nvim and mise + +## Customization + +- Modify `Brewfile` to add/remove tools +- Update `.tool-versions` to change language versions +- Plugin configuration is automatically loaded from `.config/nvim/` + +## Troubleshooting + +- **Plugin issues**: Run `nvim --headless "+Lazy! sync" +qa` +- **Language issues**: Run `mise install` to reinstall languages +- **LSP issues**: Check `:LspInfo` and `:Mason` in neovim + +## Tools Available + +| Tool | Purpose | +|------|---------| +| `nvim` | Neovim editor | +| `rg`, `fd`, `fzf` | Fast searching and file finding | +| `bat`, `tree` | Enhanced file viewing | +| `lazygit` | Git TUI | +| `tmux`, `zellij` | Terminal multiplexing | +| `mise` | Runtime version management | +| `jq`, `yq` | JSON/YAML processing | diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..f9127b1 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,70 @@ +# Use Ubuntu as base image +FROM ubuntu:22.04 + +# Set environment variables +ENV DEBIAN_FRONTEND=noninteractive +ENV HOMEBREW_NO_ANALYTICS=1 +ENV HOMEBREW_NO_INSECURE_REDIRECT=1 +ENV HOMEBREW_CASK_OPTS="--require-sha" + +# Install system dependencies +RUN apt-get update && apt-get install -y \ + build-essential \ + curl \ + file \ + git \ + procps \ + sudo \ + wget \ + ca-certificates \ + locales \ + && rm -rf /var/lib/apt/lists/* + +# Generate locale +RUN locale-gen en_US.UTF-8 +ENV LANG=en_US.UTF-8 +ENV LANGUAGE=en_US:en +ENV LC_ALL=en_US.UTF-8 + +# Create a non-root user +RUN useradd -m -s /bin/bash developer && \ + echo 'developer ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers + +# Switch to the developer user +USER developer +WORKDIR /home/developer + +# Install Homebrew +RUN /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" + +# Add Homebrew to PATH +ENV PATH="/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:${PATH}" + +# Copy Brewfile and install dependencies +COPY --chown=developer:developer Brewfile /home/developer/ +RUN brew bundle install --file=/home/developer/Brewfile + +# Copy dotfiles +COPY --chown=developer:developer . /home/developer/.dotfiles + +# Create symlinks for neovim config +RUN mkdir -p /home/developer/.config && \ + ln -sf /home/developer/.dotfiles/.config/nvim /home/developer/.config/nvim + +# Copy tool-versions for mise +RUN ln -sf /home/developer/.dotfiles/.tool-versions /home/developer/.tool-versions + +# Install languages using mise +RUN /bin/bash -c "eval \"\$(mise activate bash)\" && mise install" + +# Initialize neovim and install plugins +RUN nvim --headless "+Lazy! sync" +qa + +# Note: Treesitter parsers will be installed on first use +# You can manually install them with: :TSInstall + +# Set the working directory to dotfiles +WORKDIR /home/developer/.dotfiles + +# Default command +CMD ["/bin/bash"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..7bc0696 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,18 @@ +version: '3.8' +services: + nvim: + build: . + image: nvim-dotfiles + container_name: neovim-dev + volumes: + - .:/workspace + - nvim_data:/home/developer/.local/share/nvim + - mise_data:/home/developer/.local/share/mise + working_dir: /workspace + stdin_open: true + tty: true + command: /bin/bash + +volumes: + nvim_data: + mise_data: