Skip to content
Merged
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
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
"LazyVim": { "branch": "main", "commit": "3f034d0a7f58031123300309f2efd3bb0356ee21" },
"SchemaStore.nvim": { "branch": "main", "commit": "d521e71f9d5ac1c29a7653528d4e5c66ffe229c5" },
"blink-cmp-copilot": { "branch": "main", "commit": "439cff78780c033aa23cf061d7315314b347e3c1" },
"blink.cmp": { "branch": "main", "commit": "cb5e346d9e0efa7a3eee7fd4da0b690c48d2a98e" },
"blink.cmp": { "branch": "main", "commit": "4f38ce99a472932d5776337f08f7a8180f1f571a" },
"bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" },
"catppuccin": { "branch": "main", "commit": "5b5e3aef9ad7af84f463d17b5479f06b87d5c429" },
"catppuccin": { "branch": "main", "commit": "b7bbdf93b42866f166af98d39a2563eedb7cabac" },
"conform.nvim": { "branch": "master", "commit": "372fc521f8421b7830ea6db4d6ea3bae1c77548c" },
"copilot.lua": { "branch": "master", "commit": "a5c390f8d8e85b501b22dcb2f30e0cbbd69d5ff0" },
"flash.nvim": { "branch": "main", "commit": "3c942666f115e2811e959eabbdd361a025db8b63" },
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
"gitsigns.nvim": { "branch": "main", "commit": "ee28ba3e70ecea811b8f6d7b51d81976e94b121c" },
"gitsigns.nvim": { "branch": "main", "commit": "1796c7cedfe7e5dd20096c5d7b8b753d8f8d22eb" },
"grug-far.nvim": { "branch": "main", "commit": "6ff8a205a29db3a9b08e5debe09452b4d6fd6591" },
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
"lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" },
Expand All @@ -24,13 +24,13 @@
"noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" },
"nui.nvim": { "branch": "main", "commit": "8d5b0b568517935d3c84f257f272ef004d9f5a59" },
"nvim-lint": { "branch": "master", "commit": "9dfb77ef6c5092a19502883c02dc5a02ec648729" },
"nvim-lspconfig": { "branch": "master", "commit": "94d0fec9135719e046903bbbbf8f39e3d3436d4e" },
"nvim-lspconfig": { "branch": "master", "commit": "46434074f188e6bfccf9d9153dd8be6b1381498b" },
"nvim-treesitter": { "branch": "master", "commit": "94ea4f436d2b59c80f02e293466c374584f03b8c" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "ed373482db797bbf71bdff37a15c7555a84dce47" },
"nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" },
"persistence.nvim": { "branch": "main", "commit": "166a79a55bfa7a4db3e26fc031b4d92af71d0b51" },
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
"render-markdown.nvim": { "branch": "main", "commit": "bd5657594bf1a96b04f900c87e8d74226a54d832" },
"render-markdown.nvim": { "branch": "main", "commit": "b2d857c848c2c27440c8e5efc8e49a9b5bcf13c6" },
"snacks.nvim": { "branch": "main", "commit": "bc0630e43be5699bb94dadc302c0d21615421d93" },
"todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" },
"tokyonight.nvim": { "branch": "main", "commit": "057ef5d260c1931f1dffd0f052c685dcd14100a3" },
Expand Down
File renamed without changes.
File renamed without changes.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.dotfiles/.config/github-copilot/*
.dotfiles/.cache/*
.dotfiles/.local
.dotfiles/.npm
.dotfiles/.zcompdump-*
.dotfiles/.zsh_history

.DS_Store
41 changes: 21 additions & 20 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,43 +1,44 @@
FROM node:22.15.0-alpine
#* Set the base image to Node.js LTS on Alpine
FROM node:lts-alpine

#* Set metadata for image
LABEL maintainer="ManghiDev <https://manghi.dev>" \
description="Dockerfile for LazyVim and Zsh with Oh My Zsh" \
version="0.1.0"
description="Dockerfile for LazyVim and Zsh with oh-my-zsh" \
version="1.0.0"

#* Install necessary dependencies
RUN apk add --no-cache git lazygit fzf curl neovim ripgrep alpine-sdk zsh shadow

#* Create a new user 'develop' with home directory and grant sudo privileges
RUN useradd -m -s /bin/zsh develop && \
echo "develop ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
#* Create a new user 'developer' with home directory and grant sudo privileges
RUN useradd -m -s /bin/zsh developer && \
echo "developer ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers

#* Switch to the 'develop' user for the rest of the setup
USER develop
WORKDIR /home/develop
#* Switch to the 'developer' user for the rest of the setup
USER developer
WORKDIR /home/developer

#* Install Oh My Zsh for the 'develop' user
#* Install Oh My Zsh for the 'developer' user
RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" || true

#* Install the zsh-autosuggestions plugin
RUN git clone https://github.com/zsh-users/zsh-autosuggestions /home/develop/.oh-my-zsh/custom/plugins/zsh-autosuggestions && \
sed -i 's/plugins=(git)/plugins=(git zsh-autosuggestions)/' /home/develop/.zshrc
RUN git clone https://github.com/zsh-users/zsh-autosuggestions /home/developer/.oh-my-zsh/custom/plugins/zsh-autosuggestions && \
sed -i 's/plugins=(git)/plugins=(git zsh-autosuggestions)/' /home/developer/.zshrc

#* Install the Powerlevel10k theme
RUN git clone --depth=1 https://github.com/romkatv/powerlevel10k.git /home/develop/.oh-my-zsh/custom/themes/powerlevel10k && \
sed -i 's/ZSH_THEME=".*"/ZSH_THEME="powerlevel10k\/powerlevel10k"/' /home/develop/.zshrc
RUN git clone --depth=1 https://github.com/romkatv/powerlevel10k.git /home/developer/.oh-my-zsh/custom/themes/powerlevel10k && \
sed -i 's/ZSH_THEME=".*"/ZSH_THEME="powerlevel10k\/powerlevel10k"/' /home/developer/.zshrc

#* Clone LazyVim for the 'develop' user
RUN git clone https://github.com/LazyVim/starter /home/develop/.config/nvim
#* Clone LazyVim for the 'developer' user
RUN git clone https://github.com/LazyVim/starter /home/developer/.config/nvim

#* Remove the .git folder, so you can add it to your own repo later
RUN rm -rf /home/develop/.config/nvim/.git
RUN rm -rf /home/developer/.config/nvim/.git

#* Ensure proper permissions for the 'develop' user
RUN chown -R develop:develop /home/develop
#* Ensure proper permissions for the 'developer' user
RUN chown -R developer:developer /home/developer

#* Set the default working directory
WORKDIR /home/develop
WORKDIR /home/developer

#* Set the default shell to Zsh
CMD ["/bin/zsh"]
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2025 manghidev

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
142 changes: 105 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,66 +1,134 @@
# LazyVim Docker Environment

This repository provides a Dockerized environment for using LazyVim, Zsh with Oh My Zsh, and additional tools for development. It is designed to simplify the setup of a powerful and customizable code editor environment.
This project provides a Dockerized environment to use LazyVim, an advanced Neovim configuration, along with essential developer tools.

---

## Features

- **LazyVim**: Pre-configured Neovim setup with LazyVim.
- **Zsh with Oh My Zsh**: Includes plugins like `zsh-autosuggestions` and the `Powerlevel10k` theme.
- **Essential Tools**: Includes `git`, `lazygit`, `fzf`, `curl`, `neovim`, `ripgrep`, and more.
- **Persistent Configuration**: Root configuration is persisted using Docker volumes.
- **Customizable**: Easily extend or modify the setup to suit your needs.
- **LazyVim**: Predefined Neovim configuration to maximize productivity.
- **Dockerized**: Fully isolated and reproducible environment.
- **Zsh with Oh My Zsh**: Interactive shell with plugins and advanced customization.
- **Included tools**: `git`, `lazygit`, `fzf`, `ripgrep`, among others.
- **Volume mounting**: Direct access to your local files from the container.
- **Persistent configuration**: Configuration changes are retained between sessions.

---

## Requirements

- Docker
- Docker Compose
- **Docker**: Make sure Docker is installed on your system.
- **Docker Compose**: Required to manage the environment.

## Setup
---

1. Clone this repository:
```sh
git clone https://github.com/manghidev/lazyvim-docker.git
cd lazyvim-docker
## Available Scripts

- **`build.sh`**: Builds and configures the entire environment.
- **`init.sh`**: Access the container after exiting.
- **`destroy.sh`**: Stops and removes the containers but keeps the volumes.

### Execution Permissions

If the scripts do not have execution permissions, you can grant them using the following command, replacing `<script-name>` with the script file you want to execute:

```bash
chmod +x ./<script-name>
```

2. Build and start the container:
```sh
docker compose up -d
For example, to grant execution permissions to `build.sh`:

```bash
chmod +x ./build.sh
```

3. Access the container:
```sh
docker exec -it lazyvim /bin/zsh
---

## Installation

1. Clone this repository:
```bash
git clone https://github.com/manghidev/lazyvim-docker.git
cd lazyvim-docker
```

2. Build the environment using the `build.sh` script:
```bash
./build.sh
```

3. If you need to re-enter the container, use the `init.sh` script:
```bash
./init.sh
```

4. To destroy the environment (without deleting the volumes), use the `destroy.sh` script:
```bash
./destroy.sh
```

---

## Usage

- **Edit files**: Use LazyVim to edit your files directly from the container.
- **Customize configuration**: Modify the files in `/root/.config/nvim` to adjust LazyVim to your needs.
- **Persistence**: Configuration changes are automatically saved thanks to the Docker volume.

---

## Volume Configuration

You can edit the volumes in the `docker-compose.yml` file to add a documents folder or a USB drive according to your needs. By default, the following configurations are included:

### Documents Directory on macOS
Mount the user's Documents directory on macOS inside the container:
```yaml
- $HOME/Documents:/home/developer/Documents
```

## Directory Structure
### Documents Directory on Linux
If you are using Linux, you can mount the user's Documents directory:
```yaml
- /home/user/Documents:/home/developer/Documents
```

### USB Drive on macOS
To mount a USB drive on macOS, use the following configuration:
```yaml
- /Volumes/sdb1:/home/developer/usb
```

- `$HOME/Documents` is mounted to `/home/develop/Documents` inside the container.
- `/Volumes/ExternalSSD/Work` is mounted to `/home/develop/Work`.
- `/Volumes/ExternalSSD/Personal` is mounted to `/home/develop/Personal`.
### USB Drive on Linux
If you need to mount a USB drive on Linux, use this configuration:
```yaml
- /dev/sdb2:/home/developer/usb
```

## Persistent Configuration
### Customization Example
If you want to add a specific directory where you store your projects, you can edit the `docker-compose.yml` file and add a line like this:
```yaml
- /path/to/your/project:/home/developer/projects
```
This will mount the `/path/to/your/project` directory from your local system into the container at `/home/developer/projects`.

The root configuration is stored in a Docker volume named `root-config`. This ensures that your Zsh and LazyVim configurations persist across container restarts.
### Note
You can modify these paths directly in the `docker-compose.yml` file to adapt them to your operating system and specific needs. Make sure the local paths exist on your system before starting the container.

## Customization
---

- **Oh My Zsh Plugins**: Modify the `.zshrc` file to add or remove plugins.
- **LazyVim Configuration**: Edit the files in `/root/.config/nvim` to customize LazyVim.
## Contributions

## Included Tools
Contributions are welcome! If you have ideas or improvements, feel free to open an issue or submit a pull request.

- **LazyVim**: A pre-configured Neovim setup.
- **Oh My Zsh**: A framework for managing Zsh configuration.
- **Powerlevel10k**: A fast and customizable Zsh theme.
- **fzf**: A command-line fuzzy finder.
- **lazygit**: A simple terminal UI for Git commands.
- **ripgrep**: A fast search tool.
---

## License

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.

---

## Author

Created by ManghiDev. For more information, visit [https://manghi.dev](https://manghi.dev).
Created by ManghiDev. For more information, visit [manghi.dev](https://manghi.dev).
16 changes: 16 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
echo "Cleaning up the environment"
docker compose down --rmi all

echo "Pulling the latest images"
docker compose pull

echo "Rebuilding the container"
docker compose build --no-cache

echo "Starting the container"
docker compose up --force-recreate -d

echo "Opening a shell in the container"
docker exec -it lazyvim zsh

echo "Process completed. Container is running"
4 changes: 4 additions & 0 deletions destroy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Stop and remove the container
docker compose down --rmi all

echo "Container stopped and removed"
1 change: 0 additions & 1 deletion develop-user-data/.config/github-copilot/versions.json

This file was deleted.

8 changes: 0 additions & 8 deletions develop-user-data/.config/nvim/.gitignore

This file was deleted.

26 changes: 12 additions & 14 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,17 @@ services:
dockerfile: Dockerfile
container_name: lazyvim
volumes:
#* Mount volume for oh-my-zsh
- develop-data:/home/develop
- .dotfiles/.zshrc:/home/developer/.zshrc
- .dotfiles/.p10k.zsh:/home/developer/.p10k.zsh
- .dotfiles/.config/nvim:/home/developer/.config/nvim

#* Mount the user's Documents directory
- $HOME/Documents:/home/develop/Documents
#* Mount the Work directory
- /Volumes/ExternalSSD/Work:/home/develop/Work
#* Mount the Personal directory
- /Volumes/ExternalSSD/Personal:/home/develop/Personal
#* Mount the user's Documents directory in macOS
- $HOME/Documents:/home/developer/Documents
#* Mount the user's Documents directory in Linux
# - /home/user/Documents:/home/developer/Documents
#* Mount the user's USB in macOS
#- /Volumes/sdb1:/home/developer/usb
#* Mount the user's USB in Linux
#- /dev/sdb2:/home/developer/usb
stdin_open: true
tty: true

volumes:
#* Volume for persistent data
develop-data:
driver: local
tty: true
Loading