Configure container build workflow via GHCR

This commit is contained in:
2026-07-13 11:35:09 +01:00
parent 4300fd3edb
commit f9c128e879
5 changed files with 111 additions and 24 deletions
+7
View File
@@ -0,0 +1,7 @@
.git
.devenv
.direnv
devenv.lock
devenv.nix
devenv.yaml
.envrc
+56
View File
@@ -0,0 +1,56 @@
name: Build and Push Neovim Container
on:
push:
branches:
- main
paths-ignore:
- 'README.md'
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=latest
type=sha,format=short
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
-23
View File
@@ -1,23 +0,0 @@
name: Trigger Container Rebuild
on:
push:
branches:
- main
paths-ignore:
- "README.md"
jobs:
trigger:
runs-on: ubuntu-latest
steps:
- name: Trigger rebuild
env:
GH_TOKEN: ${{ secrets.PUBLIC_ACTION_TRIGGER_TOKEN }}
run: |
gh api \
--method POST \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/Cian-H/my_nvim/dispatches \
-f "event_type=rebuild-container" -F "client_payload[unit]=false" -F "client_payload[integration]=true"
+46
View File
@@ -0,0 +1,46 @@
FROM ubuntu:24.04
# Prevent interactive prompts during package installation
ENV DEBIAN_FRONTEND=noninteractive
# Install essential dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
curl \
ca-certificates \
build-essential \
unzip \
tar \
ripgrep \
fd-find \
python3 \
python3-pip \
python3-venv \
nodejs \
npm \
&& rm -rf /var/lib/apt/lists/*
# Install Neovim (stable/latest precompiled binary)
RUN curl -LO https://github.com/neovim/neovim/releases/download/stable/nvim-linux-x86_64.tar.gz \
&& tar -C /opt -xzf nvim-linux-x86_64.tar.gz \
&& rm nvim-linux-x86_64.tar.gz \
&& ln -s /opt/nvim-linux-x86_64/bin/nvim /usr/local/bin/nvim
# Create a non-root user and setup home directory
RUN useradd -m -s /bin/bash nvimuser
USER nvimuser
ENV HOME=/home/nvimuser
WORKDIR /workspace
# Copy the Neovim configuration files
RUN mkdir -p $HOME/.config/nvim
COPY --chown=nvimuser:nvimuser . $HOME/.config/nvim
# Pre-install plugins using Lazy.nvim sync
RUN nvim --headless "+Lazy! sync" +qa
# Run neovim headlessly for a short period to allow tree-sitter-manager and mason to install tools
RUN nvim --headless -c "sleep 15" -c "qa"
# Set up entrypoint
ENTRYPOINT ["nvim"]
+2 -1
View File
@@ -31,9 +31,10 @@ if not vim.loop.fs_stat(hotpotpath) then
})
end
---@diagnostic disable-next-line: undefined-field
---@diagnostic disable: undefined-field
vim.opt.rtp:prepend(hotpotpath)
vim.opt.rtp:prepend(lazypath)
---@diagnostic enable: undefined-field
require("hotpot")