Skip to content

Commit

Permalink
fix: compat fixes to build across docker/podman versions
Browse files Browse the repository at this point in the history
  • Loading branch information
legobeat committed Jun 5, 2024
1 parent 353cce2 commit 56e4763
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
25 changes: 17 additions & 8 deletions Containerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# syntax=docker/dockerfile:1
FROM registry.fedoraproject.org/fedora-minimal:40 AS base

RUN microdnf -y update
Expand All @@ -23,13 +24,16 @@ RUN microdnf -y install --setopt=install_weak_deps=False \
FROM base AS nvim-builder

WORKDIR /etc/xdg/nvim/pack/build-l7ide/start
COPY --chown=1001:1001 contrib/nvim-plugins/ .
RUN mkdir -p /out && chown 1001:1001 /out
COPY --chown=1001:1001 contrib/nvim-plugins/ ./
RUN mkdir -p /out /home/nvim-builder \
&& chown -R 1001:1001 /home/nvim-builder

USER 1001

# enable/disable treesitter language parsers. These are fetched remotely.
ARG TREESITTER_INSTALL='bash c dockerfile hcl javascript lua markdown nix python ruby typescript vim vimdoc yaml'

ENV HOME=/home/nvim-builder
# make nvim plugins, but skip running long-running test-only makefiles
RUN bash -c 'find . -maxdepth 1 -mindepth 1 -type d ! -name "plenary.nvim" ! -name "neo-tree.nvim" | xargs -I{} -P8 bash -c "cd {}; make -j4 build || make -j4 || true"'
RUN nvim --headless \
Expand All @@ -40,7 +44,9 @@ RUN nvim --headless \
-c "TSEnable ${TREESITTER_INSTALL}" \
-c q
WORKDIR /out
RUN mv /etc/xdg/nvim/pack/build-l7ide/start /out/plugins
USER root
RUN mkdir -p /out/plugins \
&& mv /etc/xdg/nvim/pack/build-l7ide/start/* /out/plugins/

##### TYPESCRIPT-LANGUAGE-SERVER BUILDER #####
FROM base AS tsserver-builder
Expand All @@ -50,12 +56,15 @@ RUN microdnf install -y --setopt=install_weak_deps=False npm \
&& mkdir -p /out \
&& chown 1002:1002 /out

COPY --chown=1002:1002 contrib/typescript-language-server/ /build/typescript-language-server/

WORKDIR /build/typescript-language-server
COPY --chown=1002:1002 contrib/typescript-language-server/ .
ENV HOME=/tmp/1002-home
RUN chown -R 1002:1002 .

USER 1002
RUN mkdir -p ${HOME} \
&& yarn install --frozen-lockfile --network-concurrency 10 \
ENV HOME=/tmp/1002-home

RUN yarn install --frozen-lockfile --network-concurrency 10 \
&& yarn build \
&& yarn pack
WORKDIR /out
Expand Down Expand Up @@ -94,7 +103,7 @@ RUN microdnf -y install --setopt=install_weak_deps=False \
screen \
w3m \
which procps-ng \
$EXTRA_PKGS \
${EXTRA_PKGS} \
&& ln -sf nvim /usr/bin/vim


Expand Down
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
IMAGE_NAME:=localhost/l7/nvim
IMAGE_TAG:=latest
IMAGE_NAME := localhost/l7/nvim
IMAGE_TAG := latest
USER_SHELL ?= ${SHELL}
EXTRA_PKGS := 'zsh podman'
EXTRA_PKGS := zsh podman
UID:=$(shell id -u)
GID:=$(shell id -g)
CMD:=$(shell which podman || which docker)
Expand All @@ -13,6 +13,7 @@ image_nvim:
--build-arg "UID=${UID}" \
--build-arg "GID=${GID}" \
-t "${IMAGE_NAME}:${IMAGE_TAG}" \
-f './Containerfile' \
.
test:
@echo TODO: tests

0 comments on commit 56e4763

Please sign in to comment.