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 RUN pip3 install pynvim
# Create user # 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 USER vividboarder
WORKDIR /home/vividboarder WORKDIR /home/vividboarder
@ -34,10 +34,6 @@ ENV HOME /home/vividboarder
ENV XDG_CONFIG_HOME $HOME/.config ENV XDG_CONFIG_HOME $HOME/.config
RUN mkdir -p $XDG_CONFIG_HOME RUN mkdir -p $XDG_CONFIG_HOME
# Create persistent data dir
RUN mkdir -p /home/vividboarder/.data
VOLUME /home/vividboarder/.data
# Configure go path # Configure go path
ENV GOPATH $HOME/go ENV GOPATH $HOME/go
RUN mkdir -p $GOPATH/bin RUN mkdir -p $GOPATH/bin
@ -50,18 +46,27 @@ ENV PATH $PATH:$NPM_PACKAGES/bin
ENV PATH $HOME/.local/bin:$PATH ENV PATH $HOME/.local/bin:$PATH
# Install Language servers # Install Language servers
COPY --chown=vividboarder:vividboarder ./install-language-servers.sh ./ COPY --chown=vividboarder:users ./install-language-servers.sh ./
RUN ./install-language-servers.sh RUN ./install-language-servers.sh
# Install golangci-lint # Install golangci-lint
RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $GOPATH/bin v1.43.0 RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $GOPATH/bin v1.43.0
# Add config # Add config
COPY --chown=vividboarder:vividboarder ./neovim $HOME/.config/nvim COPY --chown=vividboarder:users ./neovim $HOME/.config/nvim
# Sync packer plugins # Sync packer plugins
RUN nvim --headless -c "autocmd User PackerComplete quitall" -c "PackerBootstrap" 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 # Bootstrap treesitter parsers
RUN nvim --headless -c "TSUpdateSync" -c "quitall" 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 # Generate workdir
RUN mkdir /home/vividboarder/data 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 "$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" [ -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" # TS_PARSERS="$HOME/.local/share/nvim/site/pack/packer/start/nvim-treesitter/parser"
[ -d "$VOLUME_DATA/ts-parsers" ] || mkdir -p "$VOLUME_DATA/ts-parsers" # [ -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" # 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 if [ "$1" == "bash" ]; then
exec "$@" exec "$@"

View File

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

View File

@ -1,14 +1,7 @@
-- Configures nvim-treesitter -- Configures nvim-treesitter
require("nvim-treesitter.configs").setup({ local M = {}
incremental_selection = { enable = true },
-- Indent appears to be broken right now local ensure_installed = {
indent = { enable = false },
textobjects = { enable = true },
highlight = {
enable = true,
disable = {},
},
ensure_installed = {
"bash", "bash",
"css", "css",
"fish", "fish",
@ -20,5 +13,24 @@ require("nvim-treesitter.configs").setup({
"python", "python",
"rust", "rust",
"yaml", "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 #! /bin/bash
set -ex
if ! docker image ls -q nvim > /dev/null ;then if ! docker image ls -q nvim > /dev/null ;then
echo "no nvim image found" echo "no nvim image found"
exit 1 exit 1
@ -18,6 +20,7 @@ docker run --interactive --rm --tty \
--volume "$(pwd):/home/vividboarder/data" \ --volume "$(pwd):/home/vividboarder/data" \
--workdir /home/vividboarder/data \ --workdir /home/vividboarder/data \
--entrypoint /docker-entry.sh \ --entrypoint /docker-entry.sh \
--user "$(id -u):$(id -g)" \ --user "vividboarder:$(id -g)" \
--group-add users \
nvim "$@" nvim "$@"
# vividboarder/my-neovim 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" echo "If using Neovim, install the python modules in your environment"
nvim --headless -c PlugInstall -c qall nvim --headless -c PlugInstall -c qall
nvim --headless -c "autocmd User PackerComplete quitall" -c "PackerBootstrap" -c "PackerSync" 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" nvim --headless -c "TSUpdateSync" -c "quitall"
fi fi
if hash vim 2>/dev/null; then if hash vim 2>/dev/null; then