DEV Community

Theodor Heiselberg
Theodor Heiselberg

Posted on • Edited on

1 1 1

Run lunarvim in a devcontainer

Let's play with lunarvim

This is both fun and easy. Unfortunately the dockerfiles found in luarvim's own repos was not working for me. So here is a version which will run on apple silicon.

If you wan't the icons to be show all pretty in lvim then remember to have nerd-fonts installed on your host machine. The add this setting to your vs-code :

"terminal.integrated.fontFamily": "FiraCode Nerd Font",

{
    "name": "lunarvim-devcontainer",
    "dockerFile": "Dockerfile.lunarvim"
}
Enter fullscreen mode Exit fullscreen mode
# Use a stable version of Alpine as the base image
FROM alpine:3.18

# Set up the working directory
WORKDIR /tmp

# Set environment variables
ENV HOME_DIR="/home/lunaruser"
ENV LV_BRANCH="release-1.4/neovim-0.9"
ENV PATH="$PATH:$HOME_DIR/.local/bin"

# Install dependencies
RUN apk update && \
apk add --no-cache \
yarn \
git \
python3 \
cargo \
neovim \
ripgrep \
alpine-sdk \
bash \
curl


# Add a non-root user and group
RUN addgroup -S lunaruser && \
    adduser -S lunaruser -G lunaruser --shell /bin/sh

# Switch to the non-root user
USER lunaruser

# Run LunarVim installation as the non-root user
RUN curl -s https://raw.githubusercontent.com/lunarvim/lunarvim/$LV_BRANCH/utils/installer/install.sh | \
    bash -s -- --no-install-dependencies

# Set default command to open LunarVim - when running directly in a docker container
# CMD ["/home/lunaruser/.local/bin/lvim"]
Enter fullscreen mode Exit fullscreen mode

>> lvim [enter]

Image description

Bonus

You could just run the container interactively:

>> cd /your-path/.devcontainer/

>> docker build -t my-lunarvim-image -f Dockerfile.lunarvim . 

>> docker run -it --rm -v .:/home/lunaruser/project -w /home/lunaruser/project my-lunarvim-image /bin/bash
Enter fullscreen mode Exit fullscreen mode

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more →

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay