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

Billboard image

Synthetic monitoring. Built for developers.

Join Vercel, Render, and thousands of other teams that trust Checkly to streamline monitor creation and configuration with Monitoring as Code.

Start Monitoring

Top comments (0)

Billboard image

Imagine monitoring that's actually built for developers

Join Vercel, CrowdStrike, and thousands of other teams that trust Checkly to streamline monitor creation and configuration with Monitoring as Code.

Start Monitoring

👋 Kindness is contagious

Engage with a sea of insights in this enlightening article, highly esteemed within the encouraging DEV Community. Programmers of every skill level are invited to participate and enrich our shared knowledge.

A simple "thank you" can uplift someone's spirits. Express your appreciation in the comments section!

On DEV, sharing knowledge smooths our journey and strengthens our community bonds. Found this useful? A brief thank you to the author can mean a lot.

Okay