Get Docker install permissions working and TS

This commit is contained in:
ViViDboarder 2022-01-02 22:06:47 -08:00
parent ed6640e8e1
commit 5543af4bbc
6 changed files with 64 additions and 37 deletions

View File

@ -26,7 +26,7 @@ RUN apk add gcc g++ python3-dev
RUN pip3 install pynvim
# Create user
RUN adduser -D -h /home/vividboarder -s /bin/bash vividboarder
RUN adduser -D -h /home/vividboarder -s /bin/bash --ingroup users vividboarder
USER vividboarder
WORKDIR /home/vividboarder
@ -34,10 +34,6 @@ ENV HOME /home/vividboarder
ENV XDG_CONFIG_HOME $HOME/.config
RUN mkdir -p $XDG_CONFIG_HOME
# Create persistent data dir
RUN mkdir -p /home/vividboarder/.data
VOLUME /home/vividboarder/.data
# Configure go path
ENV GOPATH $HOME/go
RUN mkdir -p $GOPATH/bin
@ -50,18 +46,27 @@ ENV PATH $PATH:$NPM_PACKAGES/bin
ENV PATH $HOME/.local/bin:$PATH
# Install Language servers
COPY --chown=vividboarder:vividboarder ./install-language-servers.sh ./
COPY --chown=vividboarder:users ./install-language-servers.sh ./
RUN ./install-language-servers.sh
# Install golangci-lint
RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $GOPATH/bin v1.43.0
# Add config
COPY --chown=vividboarder:vividboarder ./neovim $HOME/.config/nvim
COPY --chown=vividboarder:users ./neovim $HOME/.config/nvim
# Sync packer plugins
RUN nvim --headless -c "autocmd User PackerComplete quitall" -c "PackerBootstrap"
# This may not actually do anyting. Haven't figured out how to get compiled ts files into the image
RUN nvim --headless -c "TSUpdateSync" -c "quitall"
# Bootstrap treesitter parsers
RUN nvim --headless -c "lua require('plugins.treesitter').bootstrap()" -c quitall
# Create persistent data dir
RUN mkdir -p /home/vividboarder/.data
# VOLUME /home/vividboarder/.data
# Make home dir read/write for everyone
# RUN chown -R ":users" /home/vividboarder
# RUN chmod -R a+rw /home/vividboarder
# RUN chmod -R a-s /home/vividboarder
# Generate workdir
RUN mkdir /home/vividboarder/data

View File

@ -17,9 +17,15 @@ VOLUME_DATA=/home/vividboarder/.data
[ -d "$VOLUME_DATA/nvim/backup" ] || mkdir -p "$VOLUME_DATA/nvim/backup"
[ -d "$XDG_CONFIG_HOME/nvim/backup" ] || ln -s "$VOLUME_DATA/nvim/backup" "$XDG_CONFIG_HOME/nvim/backup"
TS_PARSERS="share/nvim/site/pack/packer/start/nvim-treesitter/parser"
[ -d "$VOLUME_DATA/ts-parsers" ] || mkdir -p "$VOLUME_DATA/ts-parsers"
rm -fr "$HOME/.local/$TS_PARSERS" || ln -s "$VOLUME_DATA/ts-parsers" "$HOME/.local/$TS_PARSERS"
# TS_PARSERS="$HOME/.local/share/nvim/site/pack/packer/start/nvim-treesitter/parser"
# [ -d "$VOLUME_DATA/ts-parsers" ] || mkdir -p "$VOLUME_DATA/ts-parsers"
# rm -fr "$TS_PARSERS"
# ln -s "$VOLUME_DATA/ts-parsers" "$TS_PARSERS"
#
# TS_PARSERS="$HOME/.local/share/nvim/site/parser"
# [ -d "$VOLUME_DATA/ts-parsers" ] || mkdir -p "$VOLUME_DATA/ts-parsers"
# rm -fr "$TS_PARSERS"
# ln -s "$VOLUME_DATA/ts-parsers" "$TS_PARSERS"
if [ "$1" == "bash" ]; then
exec "$@"

View File

@ -234,7 +234,7 @@ return require("packer").startup({
"nvim-treesitter/nvim-treesitter",
run = ":TSUpdate",
config = function()
require("utils").require_with_local("plugins.treesitter")
require("plugins.treesitter").setup()
end,
})
use({

View File

@ -1,14 +1,7 @@
-- Configures nvim-treesitter
require("nvim-treesitter.configs").setup({
incremental_selection = { enable = true },
-- Indent appears to be broken right now
indent = { enable = false },
textobjects = { enable = true },
highlight = {
enable = true,
disable = {},
},
ensure_installed = {
local M = {}
local ensure_installed = {
"bash",
"css",
"fish",
@ -20,5 +13,24 @@ require("nvim-treesitter.configs").setup({
"python",
"rust",
"yaml",
}
function M.bootstrap()
require("nvim-treesitter.install").ensure_installed_sync(ensure_installed)
end
function M.setup()
require("nvim-treesitter.configs").setup({
incremental_selection = { enable = true },
-- Indent appears to be broken right now
indent = { enable = false },
textobjects = { enable = true },
highlight = {
enable = true,
disable = {},
},
ensure_installed = ensure_installed,
})
end
return M

View File

@ -1,5 +1,7 @@
#! /bin/bash
set -ex
if ! docker image ls -q nvim > /dev/null ;then
echo "no nvim image found"
exit 1
@ -18,6 +20,7 @@ docker run --interactive --rm --tty \
--volume "$(pwd):/home/vividboarder/data" \
--workdir /home/vividboarder/data \
--entrypoint /docker-entry.sh \
--user "$(id -u):$(id -g)" \
--user "vividboarder:$(id -g)" \
--group-add users \
nvim "$@"
# vividboarder/my-neovim nvim "$@"

View File

@ -27,6 +27,7 @@ if hash nvim 2>/dev/null; then
echo "If using Neovim, install the python modules in your environment"
nvim --headless -c PlugInstall -c qall
nvim --headless -c "autocmd User PackerComplete quitall" -c "PackerBootstrap" -c "PackerSync"
nvim --headless -c "lua require('plugins.treesitter').bootstrap()" -c quitall
nvim --headless -c "TSUpdateSync" -c "quitall"
fi
if hash vim 2>/dev/null; then