Run lunarvim in a devcontainer



This content originally appeared on DEV Community and was authored by Theodor Heiselberg

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.

{
    "name": "lunarvim-devcontainer",
    "dockerFile": "Dockerfile.lunarvim"
}
# 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

# Define the volume for the .bashrc file
VOLUME /home/lunaruser/.bashrc

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

>> lvim [enter]

Image description


This content originally appeared on DEV Community and was authored by Theodor Heiselberg