From 75d9b3c3aa29b0a95142f35de85175e89651db02 Mon Sep 17 00:00:00 2001 From: pml68 Date: Tue, 17 Dec 2024 01:01:50 +0100 Subject: feat: switch to rustup pkg over rust, no-tex becomes base --- .github/workflows/docker.yml | 29 ++++++++----------- Dockerfile | 19 ++++--------- Dockerfile.no-tex | 48 -------------------------------- Dockerfile.tex | 65 +++++++++++++++++++++++++++++++++++++++++++ README.md | 28 +++++++++++++++---- spell/en.utf-8.add | 1 + spell/en.utf-8.add.spl | Bin 157 -> 172 bytes 7 files changed, 106 insertions(+), 84 deletions(-) delete mode 100644 Dockerfile.no-tex create mode 100644 Dockerfile.tex diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 7778d04..54ec530 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -7,8 +7,6 @@ on: tags: - v* pull_request: -env: - IMAGE_NAME: neovim jobs: push: @@ -17,11 +15,11 @@ jobs: image: [ { dockerfile: 'Dockerfile', - tag: '' + tag: 'neovim' }, { - dockerfile: 'Dockerfile.no-tex', - tag: 'no-tex-' + dockerfile: 'Dockerfile.tex', + tag: 'neovim-tex' }, ] runs-on: ubuntu-latest @@ -33,21 +31,18 @@ jobs: - uses: actions/checkout@v4 - name: Build image - run: docker build . --file ${{ matrix.image.dockerfile }} --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}" + run: docker build . --file ${{ matrix.image.dockerfile }} --tag ${{ matrix.image.tag }} --label "runnumber=${GITHUB_RUN_ID}" - name: Log in to registry run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin - name: Push image - run: | - IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME + run: docker push ${{ matrix.image.tag }} - IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') - TAG=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') - [[ "${{ github.ref }}" == "refs/tags/"* ]] && TAG=$(echo $TAG | sed -e 's/^v//') - [ "$TAG" == "master" ] && TAG="latest" - TAG=${{ matrix.image.tag }}$TAG - echo IMAGE_ID=$IMAGE_ID - echo TAG=$TAG - docker tag $IMAGE_NAME $IMAGE_ID:$TAG - docker push $IMAGE_ID:$TAG + - name: Delete previous releases + uses: actions/delete-package-versions@v5 + with: + package-name: ${{ matrix.image.tag }} + package-type: 'container' + min-versions-to-keep: 0 + delete-only-untagged-versions: 'true' diff --git a/Dockerfile b/Dockerfile index 77ec58d..11b692d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,7 +19,7 @@ RUN apk add --no-cache wget \ gzip \ neovim-doc \ ripgrep \ - rust \ + rustup \ python3 \ openjdk21 \ openjdk17 \ @@ -30,21 +30,14 @@ RUN apk add --no-cache wget \ nodejs \ npm -# install TeX -RUN apk add --no-cache texlive \ - texlive-binextra \ - texmf-dist-fontutils \ - texmf-dist-fontsrecommended \ - texmf-dist-langenglish \ - texmf-dist-langeuropean \ - texmf-dist-latexextra \ - texmf-dist-latexrecommended \ - texmf-dist-pictures \ - texmf-dist-plaingeneric - # pre-download lazy.nvim RUN git clone --filter=blob:none https://github.com/folke/lazy.nvim.git --branch=stable /root/.local/share/nvim/lazy/lazy.nvim +RUN rustup-init -y --default-toolchain none +RUN /root/.cargo/bin/rustup toolchain install nightly --allow-downgrade --profile minimal --component rustfmt,rust-src,clippy + +RUN echo -e "[unstable]\ngc = true" > /root/.cargo/config.toml + # copy config files COPY .bashrc .bashrc COPY . .config/nvim diff --git a/Dockerfile.no-tex b/Dockerfile.no-tex deleted file mode 100644 index 3342c16..0000000 --- a/Dockerfile.no-tex +++ /dev/null @@ -1,48 +0,0 @@ -FROM alpine:edge AS base -WORKDIR /root -SHELL ["/bin/sh", "-c"] - -RUN apk add --no-cache git \ - lazygit \ - neovim \ - man-pages \ - alpine-sdk \ - bash \ - eza \ - ncurses \ - util-linux-misc \ - curl \ - --update - -# install deps needed by neovim -RUN apk add --no-cache wget \ - gzip \ - neovim-doc \ - ripgrep \ - rust \ - python3 \ - openjdk21 \ - openjdk17 \ - gradle \ - go \ - dotnet8-sdk \ - clang19-extra-tools \ - nodejs \ - npm - -# pre-download lazy.nvim -RUN git clone --filter=blob:none https://github.com/folke/lazy.nvim.git --branch=stable /root/.local/share/nvim/lazy/lazy.nvim - -# copy config files -COPY .bashrc .bashrc -COPY . .config/nvim - -FROM base -SHELL ["/bin/bash", "-c"] -WORKDIR /root -RUN nvim --headless +"Lazy! sync" +qa; rm -rf /root/.cache - -# symlink the clangd executable, since it can't be installed with mason -RUN ln -sf /usr/bin/clangd /root/.local/share/nvim/mason/bin/clangd - -ENTRYPOINT ["/bin/bash"] diff --git a/Dockerfile.tex b/Dockerfile.tex new file mode 100644 index 0000000..b411266 --- /dev/null +++ b/Dockerfile.tex @@ -0,0 +1,65 @@ +FROM alpine:edge AS base +WORKDIR /root +SHELL ["/bin/sh", "-c"] + +RUN apk add --no-cache git \ + lazygit \ + neovim \ + man-pages \ + alpine-sdk \ + bash \ + eza \ + ncurses \ + util-linux-misc \ + curl \ + --update + +# install deps needed by neovim +RUN apk add --no-cache wget \ + gzip \ + neovim-doc \ + ripgrep \ + rustup \ + python3 \ + openjdk21 \ + openjdk17 \ + gradle \ + go \ + dotnet8-sdk \ + clang19-extra-tools \ + nodejs \ + npm + +# install TeX +RUN apk add --no-cache texlive \ + texlive-binextra \ + texmf-dist-fontutils \ + texmf-dist-fontsrecommended \ + texmf-dist-langenglish \ + texmf-dist-langeuropean \ + texmf-dist-latexextra \ + texmf-dist-latexrecommended \ + texmf-dist-pictures \ + texmf-dist-plaingeneric + +# pre-download lazy.nvim +RUN git clone --filter=blob:none https://github.com/folke/lazy.nvim.git --branch=stable /root/.local/share/nvim/lazy/lazy.nvim + +RUN rustup-init -y --default-toolchain none +RUN /root/.cargo/bin/rustup toolchain install nightly --allow-downgrade --profile minimal --component rustfmt,rust-src,clippy + +RUN echo -e "[unstable]\ngc = true" > /root/.cargo/config.toml + +# copy config files +COPY .bashrc .bashrc +COPY . .config/nvim + +FROM base +SHELL ["/bin/bash", "-c"] +WORKDIR /root +RUN nvim --headless +"Lazy! sync" +qa; rm -rf /root/.cache + +# symlink the clangd executable, since it can't be installed with mason +RUN ln -sf /usr/bin/clangd /root/.local/share/nvim/mason/bin/clangd + +ENTRYPOINT ["/bin/bash"] diff --git a/README.md b/README.md index 6a7cc62..3624f6c 100644 --- a/README.md +++ b/README.md @@ -17,16 +17,32 @@ Pull the image docker pull ghcr.io/pml68/neovim:latest ``` -OR - -Build the image +Or build it ```sh -docker build -t neovim . +docker build -t neovim -f Dockerfile . ``` And then run it ```sh -docker run -it neovim:latest bash +docker run -it neovim:latest ``` -The image size is somewhere around 4.7GB due to every language I use being included (C# with .NET, Java 21 and 17 etc.) +The image size is somewhere around 4.5GB due to every language I use being included (C# with .NET, Java 21 and 17 etc.) + +### TeX + +There is also an image that contains texlive packages I use on top of everything in the base image. The size is ~5.4GB. + +Pull or build the image +```sh +docker pull ghcr.io/pml68/neovim-tex:latest + +# OR + +docker build -t neovim-tex -f Dockerfile.tex . +``` + +And run it +```sh +docker run -it neovim-tex:latest +``` diff --git a/spell/en.utf-8.add b/spell/en.utf-8.add index 46d1129..44dd949 100644 --- a/spell/en.utf-8.add +++ b/spell/en.utf-8.add @@ -8,3 +8,4 @@ distros suckless Rosé tmux +texlive diff --git a/spell/en.utf-8.add.spl b/spell/en.utf-8.add.spl index 0159606..f956878 100644 Binary files a/spell/en.utf-8.add.spl and b/spell/en.utf-8.add.spl differ -- cgit v1.2.3