Compare commits
62 Commits
main
..
9fbc411dab
| Author | SHA1 | Date | |
|---|---|---|---|
| 9fbc411dab | |||
| ece5e86a16 | |||
| 065eeedce2 | |||
| 8f4c57d178 | |||
| 09af0db185 | |||
| 9d90ea60f2 | |||
| 790c7c722c | |||
| 35c4f7ed8f | |||
| 8c981a8e8d | |||
| f7da637a1c | |||
| f6bd18cf7d | |||
| 50fc142407 | |||
| 2d7807ea60 | |||
| 5fc464aa6d | |||
| 3560f348a7 | |||
| a0b65c856d | |||
| 393e49c781 | |||
| 9bed5b823f | |||
| 641d1c3050 | |||
| e180de3a7b | |||
| 7fdb0e0fc0 | |||
| 0c76caa267 | |||
| 420d4a287a | |||
| 5bc72a6fb3 | |||
| a1332e1f69 | |||
| d545a9cdf0 | |||
| fedeb5d58d | |||
| fc68b611fe | |||
| 702687276a | |||
| b11b9fd153 | |||
| 5868d34775 | |||
| 6fffe4e0a0 | |||
| ee6ffcd31a | |||
| 4c454ed3ef | |||
| 4a9e54b8b3 | |||
| 9498c36701 | |||
| 8d2948dcef | |||
| 1bad1c00eb | |||
| b6b9fc4f6b | |||
| a8ee5a8ee1 | |||
| ad2f27b8a8 | |||
| d97a76499f | |||
| 80995c560f | |||
| 89dbfcb996 | |||
| a67ea6c795 | |||
| 63ac1aae83 | |||
| df8b7b5bfe | |||
| 53cfeb1a62 | |||
| 562b26b96a | |||
| 7465b394f4 | |||
| 2e49a4f3a3 | |||
| 755605b2fb | |||
| 5c7db03b32 | |||
| 8c13f219b5 | |||
| 6556db0ce6 | |||
| 0e51472973 | |||
| 54865b536a | |||
| 7a63471603 | |||
| 9a20313beb | |||
| 5e3d7ca7fb | |||
| 17e3a6840f | |||
| c510c7f919 |
@@ -1,115 +0,0 @@
|
|||||||
name: Build containers
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
push:
|
|
||||||
branches: ["main"]
|
|
||||||
paths: ["containers/**", ".gitea/workflows/build.yaml"]
|
|
||||||
pull_request:
|
|
||||||
branches: ["main"]
|
|
||||||
paths: ["containers/**", ".gitea/workflows/build.yaml"]
|
|
||||||
schedule:
|
|
||||||
- cron: "0 16 * * FRI"
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
changes:
|
|
||||||
runs-on: job-v2
|
|
||||||
outputs:
|
|
||||||
base: ${{ steps.filter.outputs.base == 'true' }}
|
|
||||||
infra: ${{ steps.filter.outputs.infra == 'true' || steps.filter.outputs.base == 'true' }}
|
|
||||||
go: ${{ steps.filter.outputs.go == 'true' || steps.filter.outputs.base == 'true' }}
|
|
||||||
php: ${{ steps.filter.outputs.php == 'true' || steps.filter.outputs.base == 'true' }}
|
|
||||||
any_change: ${{ steps.filter.outputs.workflow == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'}}
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- uses: https://github.com/dorny/paths-filter@v3
|
|
||||||
id: filter
|
|
||||||
with:
|
|
||||||
filters: |
|
|
||||||
workflow: ['.gitea/workflows/build.yaml']
|
|
||||||
base: ['containers/base/**']
|
|
||||||
infra: ['containers/infra/**']
|
|
||||||
go: ['containers/go/**']
|
|
||||||
php: ['containers/php/**']
|
|
||||||
|
|
||||||
base-image:
|
|
||||||
needs: [changes]
|
|
||||||
if: ${{ needs.changes.outputs.base == 'true' || needs.changes.outputs.any_change == 'true' }}
|
|
||||||
runs-on: job-v2
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: Log in
|
|
||||||
uses: redhat-actions/podman-login@v1
|
|
||||||
with:
|
|
||||||
registry: git.plabble.org
|
|
||||||
username: ${{ secrets.REGISTRY_USERNAME }}
|
|
||||||
password: ${{ secrets.REGISTRY_TOKEN }}
|
|
||||||
- name: Build
|
|
||||||
id: build
|
|
||||||
uses: job79/buildah-build@65b3793a1370c1ccd74a5c0d090d70eb9637a4ef
|
|
||||||
with:
|
|
||||||
image: job79/base
|
|
||||||
tags: ${{ github.ref_name }}
|
|
||||||
context: ./containers/base
|
|
||||||
containerfiles: ./containers/base/Containerfile
|
|
||||||
platforms: linux/amd64
|
|
||||||
- name: Push
|
|
||||||
uses: redhat-actions/push-to-registry@v2
|
|
||||||
with:
|
|
||||||
image: ${{ steps.build.outputs.image }}
|
|
||||||
tags: ${{ steps.build.outputs.tags }}
|
|
||||||
registry: git.plabble.org
|
|
||||||
username: ${{ secrets.REGISTRY_USERNAME }}
|
|
||||||
password: ${{ secrets.REGISTRY_TOKEN }}
|
|
||||||
extra-args: |
|
|
||||||
--compression-format=zstd
|
|
||||||
--compression-level=12
|
|
||||||
|
|
||||||
dependent-images:
|
|
||||||
needs: [changes, base-image]
|
|
||||||
if: always() && needs.changes.result == 'success' && (needs.base-image.result == 'success' || needs.base-image.result == 'skipped')
|
|
||||||
runs-on: job-v2
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
container: [infra, go, php]
|
|
||||||
steps:
|
|
||||||
- name: Check if build needed
|
|
||||||
id: check
|
|
||||||
run: |
|
|
||||||
if [[ "${{ matrix.container }}" == "infra" && "${{ needs.changes.outputs.infra }}" == "true" ]]; then echo "run=true" >> $GITHUB_OUTPUT; fi
|
|
||||||
if [[ "${{ matrix.container }}" == "go" && "${{ needs.changes.outputs.go }}" == "true" ]]; then echo "run=true" >> $GITHUB_OUTPUT; fi
|
|
||||||
if [[ "${{ matrix.container }}" == "php" && "${{ needs.changes.outputs.php }}" == "true" ]]; then echo "run=true" >> $GITHUB_OUTPUT; fi
|
|
||||||
if [[ "${{ needs.changes.outputs.any_change }}" == "true" ]]; then echo "run=true" >> $GITHUB_OUTPUT; fi
|
|
||||||
- name: Clone repo
|
|
||||||
if: steps.check.outputs.run == 'true'
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
- name: Log in
|
|
||||||
if: steps.check.outputs.run == 'true'
|
|
||||||
uses: redhat-actions/podman-login@v1
|
|
||||||
with:
|
|
||||||
registry: git.plabble.org
|
|
||||||
username: ${{ secrets.REGISTRY_USERNAME }}
|
|
||||||
password: ${{ secrets.REGISTRY_TOKEN }}
|
|
||||||
- name: Build
|
|
||||||
id: build
|
|
||||||
if: steps.check.outputs.run == 'true'
|
|
||||||
uses: job79/buildah-build@65b3793a1370c1ccd74a5c0d090d70eb9637a4ef
|
|
||||||
with:
|
|
||||||
image: job79/${{ matrix.container }}
|
|
||||||
tags: ${{ github.ref_name }}
|
|
||||||
context: ./containers/${{ matrix.container }}
|
|
||||||
containerfiles: ./containers/${{ matrix.container }}/Containerfile
|
|
||||||
build-args: TAG=${{ github.ref_name }}
|
|
||||||
platforms: linux/amd64
|
|
||||||
- name: Push
|
|
||||||
if: steps.check.outputs.run == 'true'
|
|
||||||
uses: redhat-actions/push-to-registry@v2
|
|
||||||
with:
|
|
||||||
image: ${{ steps.build.outputs.image }}
|
|
||||||
tags: ${{ steps.build.outputs.tags }}
|
|
||||||
registry: git.plabble.org
|
|
||||||
username: ${{ secrets.REGISTRY_USERNAME }}
|
|
||||||
password: ${{ secrets.REGISTRY_TOKEN }}
|
|
||||||
extra-args: |
|
|
||||||
--compression-format=zstd
|
|
||||||
--compression-level=12
|
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
name: Container build
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 16 * * FRI'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
container-build:
|
||||||
|
runs-on: citadel
|
||||||
|
if: gitea.ref == 'refs/heads/main'
|
||||||
|
env:
|
||||||
|
RUNNER_TOOL_CACHE: /toolcache
|
||||||
|
steps:
|
||||||
|
- name: Clone repo
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Set up BuildX
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
with:
|
||||||
|
endpoint: 'unix:///var/run/docker.sock'
|
||||||
|
- name: Login to Registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: git.plabble.org
|
||||||
|
username: ${{ secrets.REGISTRY_USERNAME }}
|
||||||
|
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||||
|
- name: Build and push
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./Containerfile
|
||||||
|
push: true
|
||||||
|
tags: git.plabble.org/job79/dev:latest
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
# ========================================= #
|
||||||
|
# Containerfile v1.0; job79 #
|
||||||
|
# Configure and setup a neovim devcontainer #
|
||||||
|
# for go and nodejs development. #
|
||||||
|
# ========================================= #
|
||||||
|
FROM quay.io/fedora/fedora:41
|
||||||
|
|
||||||
|
# === setup system ===
|
||||||
|
RUN dnf update -y && dnf -y install neovim unzip \
|
||||||
|
bash-completion zoxide fd-find chafa procps \
|
||||||
|
git go npm
|
||||||
|
|
||||||
|
# === setup container user ===
|
||||||
|
RUN useradd -ms /bin/bash user && usermod -aG wheel user && sed -i '/NOPASSWD/s/^#//g' /etc/sudoers
|
||||||
|
RUN mkdir /run/user/1000 && chown user:user /run/user/1000
|
||||||
|
USER user
|
||||||
|
WORKDIR /home/user
|
||||||
|
COPY config/user/bashrc /home/user/.bashrc
|
||||||
|
COPY config/user/profile /home/user/.bash_profile
|
||||||
|
|
||||||
|
# === setup neovim ===
|
||||||
|
RUN git clone --depth 1 https://github.com/LazyVim/starter ~/.config/nvim
|
||||||
|
COPY --chown=user:user config/nvim/plugins /home/user/.config/nvim/lua/plugins
|
||||||
|
COPY --chown=user:user config/nvim/config /home/user/.config/nvim/lua/config
|
||||||
|
COPY --chown=user:user config/nvim/lazyvim.json /home/user/.config/nvim/lazyvim.json
|
||||||
|
|
||||||
|
# === setup container ===
|
||||||
|
ENV TZ="Europe/Amsterdam"
|
||||||
|
VOLUME /home/user/.local /home/user/.cache
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
-- Configure custom keymaps.
|
||||||
|
local keymap = vim.keymap.set
|
||||||
|
local delkeymap = vim.keymap.del
|
||||||
|
local opts = { noremap = true, silent = true }
|
||||||
|
|
||||||
|
-- Improved line start/end
|
||||||
|
keymap({ "n", "v" }, "H", "^", opts)
|
||||||
|
keymap({ "n", "v" }, "L", "$", opts)
|
||||||
|
|
||||||
|
-- Improved escape
|
||||||
|
keymap("n", "<ESC>", "<ESC>:noh<CR>", opts)
|
||||||
|
keymap("t", "<ESC><ESC>", "<C-\\><C-n>", opts)
|
||||||
|
|
||||||
|
-- Disable alt j/k to move lines (conflict with default vim motions)
|
||||||
|
delkeymap({ "i", "v" }, "<A-j>")
|
||||||
|
delkeymap({ "i", "v" }, "<A-k>")
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||||
|
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||||
|
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
|
||||||
|
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
|
||||||
|
if vim.v.shell_error ~= 0 then
|
||||||
|
vim.api.nvim_echo({
|
||||||
|
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
|
||||||
|
{ out, "WarningMsg" },
|
||||||
|
{ "\nPress any key to exit..." },
|
||||||
|
}, true, {})
|
||||||
|
vim.fn.getchar()
|
||||||
|
os.exit(1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
|
require("lazy").setup({
|
||||||
|
spec = {
|
||||||
|
-- add LazyVim and import its plugins
|
||||||
|
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
|
||||||
|
-- import/override with your plugins
|
||||||
|
{ import = "plugins" },
|
||||||
|
},
|
||||||
|
defaults = {
|
||||||
|
-- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup.
|
||||||
|
-- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default.
|
||||||
|
lazy = false,
|
||||||
|
-- It's recommended to leave version=false for now, since a lot the plugin that support versioning,
|
||||||
|
-- have outdated releases, which may break your Neovim install.
|
||||||
|
version = false, -- always use the latest git commit
|
||||||
|
-- version = "*", -- try installing the latest stable version for plugins that support semver
|
||||||
|
},
|
||||||
|
install = {},
|
||||||
|
checker = {
|
||||||
|
enabled = true, -- check for plugin updates periodically
|
||||||
|
notify = false, -- notify on update
|
||||||
|
}, -- automatically check for plugin updates
|
||||||
|
performance = {
|
||||||
|
rtp = {
|
||||||
|
-- disable some rtp plugins
|
||||||
|
disabled_plugins = {
|
||||||
|
"gzip",
|
||||||
|
-- "matchit",
|
||||||
|
-- "matchparen",
|
||||||
|
-- "netrwPlugin",
|
||||||
|
"tarPlugin",
|
||||||
|
"tohtml",
|
||||||
|
"tutor",
|
||||||
|
"zipPlugin",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
-- Set some custom options.
|
||||||
|
local opt = vim.opt
|
||||||
|
local global = vim.g
|
||||||
|
|
||||||
|
-- Set target text width for gww to 60.
|
||||||
|
opt.tw = 60
|
||||||
|
|
||||||
|
-- Use the internal clipboard.
|
||||||
|
opt.clipboard = ""
|
||||||
|
|
||||||
|
-- Use original gruvbox theme.
|
||||||
|
global.gruvbox_material_foreground = "original"
|
||||||
|
|
||||||
|
-- Disable snack animations.
|
||||||
|
global.snacks_animate = false
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"extras": [
|
||||||
|
"lazyvim.plugins.extras.ai.copilot",
|
||||||
|
"lazyvim.plugins.extras.dap.core",
|
||||||
|
"lazyvim.plugins.extras.lang.go",
|
||||||
|
"lazyvim.plugins.extras.lang.svelte",
|
||||||
|
"lazyvim.plugins.extras.lang.tailwind",
|
||||||
|
"lazyvim.plugins.extras.lang.typescript",
|
||||||
|
"lazyvim.plugins.extras.test.core"
|
||||||
|
],
|
||||||
|
"version": 7
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
-- Configure rose-pine and gruvbox-material colorschemes.
|
||||||
|
return {
|
||||||
|
{ "rose-pine/neovim" },
|
||||||
|
{ "sainnhe/gruvbox-material" },
|
||||||
|
{
|
||||||
|
"LazyVim/LazyVim",
|
||||||
|
opts = { colorscheme = "gruvbox-material" },
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
-- Disable unused plugins and functionality.
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
-- Disable the dashboard.
|
||||||
|
"folke/snacks.nvim",
|
||||||
|
opts = {
|
||||||
|
dashboard = { enabled = false },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
-- Disable inline hints by default.
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
opts = {
|
||||||
|
inlay_hints = { enabled = false },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Disable unused plugins.
|
||||||
|
{ "flash.nvim", enabled = false },
|
||||||
|
{ "bufferline.nvim", enabled = false },
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
. /etc/bashrc
|
||||||
|
|
||||||
|
# === environment ===
|
||||||
|
export EDITOR=nvim \
|
||||||
|
WAYLAND_DISPLAY=wayland-0 \
|
||||||
|
XDG_RUNTIME_DIR=/run/user/1000 \
|
||||||
|
SSH_AUTH_SOCK=/run/user/1000/ssh-auth-sock \
|
||||||
|
PS1='\[\e[30;46m\] container | \w \[\e[0;36m\]\[\e[m\] '
|
||||||
|
|
||||||
|
# === aliases and functions ===
|
||||||
|
alias vi=nvim
|
||||||
|
post() { curl -sF "content=<-" "https://paste.plabble.org/$2?lang=$1" && echo; }
|
||||||
|
eval "$(zoxide init --cmd cd bash)"
|
||||||
|
eval "$(fzf --bash)"
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
. ~/.bashrc
|
||||||
|
|
||||||
|
# === persist copilot auth files inside .local volume ===
|
||||||
|
if [ ! -d ~/.config/github-copilot ]; then
|
||||||
|
mkdir -p ~/.local/share/github-copilot
|
||||||
|
ln -s ~/.local/share/github-copilot ~/.config
|
||||||
|
fi
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
FROM quay.io/fedora/fedora:44
|
|
||||||
|
|
||||||
# === install system packages ===
|
|
||||||
RUN --mount=type=cache,id=dnf-cache,target=/var/cache/libdnf5 \
|
|
||||||
dnf update -y && \
|
|
||||||
dnf -y --setopt=keepcache=1 --setopt=install_weak_deps=False install \
|
|
||||||
bash-completion git-core fzf curl awk jq fd-find rg unzip which \
|
|
||||||
host-spawn wl-copy gcc
|
|
||||||
|
|
||||||
RUN LAZYGIT_VERSION=$(curl -s "https://api.github.com/repos/jesseduffield/lazygit/releases/latest" | jq -r .tag_name | sed 's/^v//') && \
|
|
||||||
curl -sL "https://github.com/jesseduffield/lazygit/releases/latest/download/lazygit_${LAZYGIT_VERSION}_linux_x86_64.tar.gz" | tar xz -C /usr/local/bin lazygit && \
|
|
||||||
curl -sL "https://github.com/jorgerojas26/lazysql/releases/latest/download/lazysql_Linux_x86_64.tar.gz" | tar xz -C /usr/local/bin lazysql && \
|
|
||||||
curl -sL "https://github.com/neovim/neovim/releases/download/nightly/nvim-linux-x86_64.tar.gz" | tar xz -C /usr/local --strip-components=1
|
|
||||||
|
|
||||||
COPY config/bin /usr/local/bin
|
|
||||||
|
|
||||||
# === setup user ===
|
|
||||||
RUN useradd -ms /bin/bash user && \
|
|
||||||
echo 'user ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/user && \
|
|
||||||
mkdir -p /run/user/1000 && \
|
|
||||||
chown user:user /run/user/1000
|
|
||||||
|
|
||||||
USER user
|
|
||||||
WORKDIR /home/user
|
|
||||||
|
|
||||||
RUN mkdir -p .config .local .cache && \
|
|
||||||
git clone https://git.plabble.org/Job79/neovim-config.git .config/nvim
|
|
||||||
|
|
||||||
COPY --chown=user:user config/bashrc .bashrc
|
|
||||||
COPY --chown=user:user config/git .config/git/config
|
|
||||||
|
|
||||||
VOLUME /home/user
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
source /etc/bashrc
|
|
||||||
|
|
||||||
# === bash settings ===
|
|
||||||
set -o vi
|
|
||||||
bind -m vi-insert '"\C-l": clear-screen'
|
|
||||||
|
|
||||||
# === environment ===
|
|
||||||
export PS1="\[\e[30;46m\] \h | \w \[\e[0;36m\]\[\e[m\] " \
|
|
||||||
EDITOR="nvim" \
|
|
||||||
WAYLAND_DISPLAY="wayland-0" \
|
|
||||||
XDG_RUNTIME_DIR="/run/user/1000" \
|
|
||||||
SSH_AUTH_SOCK="/run/user/1000/ssh-auth-sock" \
|
|
||||||
TZ="Europe/Amsterdam" \
|
|
||||||
FZF_CTRL_T_COMMAND="fd --type f --hidden --exclude .git --exclude Library --exclude .cache" \
|
|
||||||
FZF_ALT_C_COMMAND="fd --type d --hidden --exclude .git --exclude Library --exclude .cache"
|
|
||||||
|
|
||||||
# === aliases and functions ===
|
|
||||||
alias vi=nvim
|
|
||||||
post() { curl -sF "content=<-" "https://paste.plabble.org/$2?lang=$1" && echo; }
|
|
||||||
|
|
||||||
eval "$(fzf --bash)"
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
export DBUS_SESSION_BUS_ADDRESS="unix:path=/tmp/bus"
|
|
||||||
|
|
||||||
cmd="${0##*/}"
|
|
||||||
[[ "$cmd" == "host" ]] && unset cmd
|
|
||||||
exec host-spawn -cwd "${PWD/#$HOME/$HOST_HOME}" ${cmd:+"$cmd"} "$@"
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
host
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
host
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
[user]
|
|
||||||
email = job@plabble.org
|
|
||||||
name = Job79
|
|
||||||
signingKey = ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPsqM6ABAaCTQZ+llFXD3CXrYYuIHDEnvz8IBbXddYEc job@plabble.org
|
|
||||||
[gpg]
|
|
||||||
format = ssh
|
|
||||||
[commit]
|
|
||||||
gpgSign = true
|
|
||||||
[push]
|
|
||||||
autoSetupRemote = true
|
|
||||||
[init]
|
|
||||||
defaultBranch = main
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
ARG TAG
|
|
||||||
FROM job79/base:${TAG}
|
|
||||||
USER root
|
|
||||||
|
|
||||||
RUN GO_VERSION=$(curl -sL "https://go.dev/VERSION?m=text" | head -n 1 | tr -d '\r\n') && \
|
|
||||||
curl -sL "https://go.dev/dl/${GO_VERSION}.linux-amd64.tar.gz" | tar xz -C /usr/local && \
|
|
||||||
ln -sf /usr/local/go/bin/go /usr/local/bin/go && \
|
|
||||||
ln -sf /usr/local/go/bin/gofmt /usr/local/bin/gofmt
|
|
||||||
|
|
||||||
USER user
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
run_opts+=("-v" "$HOME/Documents/go:/home/user/Documents/go")
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
ARG TAG
|
|
||||||
FROM job79/base:${TAG}
|
|
||||||
USER root
|
|
||||||
|
|
||||||
RUN --mount=type=cache,id=dnf-cache,target=/var/cache/libdnf5 \
|
|
||||||
dnf -y --setopt=keepcache=1 --setopt=install_weak_deps=False install \
|
|
||||||
just kubectl k9s openssl age "$(curl -s https://api.github.com/repos/getsops/sops/releases/latest | jq -r ".assets[] | select(.name | test(\"sops-.*.$(arch).rpm\$\")) | .browser_download_url")" && \
|
|
||||||
curl -sL https://talos.dev/install | sh && \
|
|
||||||
curl -s https://fluxcd.io/install.sh | bash
|
|
||||||
|
|
||||||
USER user
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
run_opts+=("-v" "$HOME/Documents/infra:/home/user/Documents/infra")
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
ARG TAG
|
|
||||||
FROM job79/base:${TAG}
|
|
||||||
USER root
|
|
||||||
|
|
||||||
RUN --mount=type=cache,id=dnf-cache,target=/var/cache/libdnf5 \
|
|
||||||
dnf -y --setopt=keepcache=1 install php composer npm && \
|
|
||||||
composer global require laravel/installer
|
|
||||||
|
|
||||||
USER user
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
run_opts+=("-v" "$HOME/Documents/php:/home/user/Documents/php")
|
|
||||||
@@ -1,78 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# =============================================== #
|
|
||||||
# devc.sh v2.1; job79, maurice #
|
|
||||||
# Dev container entry script. #
|
|
||||||
# =============================================== #
|
|
||||||
set -euo pipefail
|
|
||||||
log() { echo -e "\e[36m○\e[0m $1"; }
|
|
||||||
die() { echo -e "\e[31mx\e[0m $1" && exit 1; }
|
|
||||||
|
|
||||||
# default_args configures standard container options.
|
|
||||||
default_args() {
|
|
||||||
run_opts+=(
|
|
||||||
"--name" "$name"
|
|
||||||
"--hostname" "$name"
|
|
||||||
"--pull=newer" # Update image.
|
|
||||||
"--userns=keep-id" # Map host user.
|
|
||||||
"-v" "$name:/home/user:copy" # Persistent home volume.
|
|
||||||
"-v" "dnf-cache:/var/cache/libdnf5" # Cache dnf metadata.
|
|
||||||
)
|
|
||||||
|
|
||||||
# Unix sockets require SELinux label disable.
|
|
||||||
[[ -d /sys/fs/selinux ]] && run_opts+=("--security-opt" "label=disable")
|
|
||||||
|
|
||||||
# Desktop integration (Wayland, SSH).
|
|
||||||
[[ -e "/run/user/$UID/wayland-0" ]] && run_opts+=("-v" "/run/user/$UID/wayland-0:/run/user/1000/wayland-0")
|
|
||||||
[[ -e "${SSH_AUTH_SOCK:-}" ]] && run_opts+=("-v" "$SSH_AUTH_SOCK:/run/user/1000/ssh-auth-sock")
|
|
||||||
|
|
||||||
# Load custom container config.
|
|
||||||
local config_file="${BASH_SOURCE[0]%/*}/containers/$name/config.sh"
|
|
||||||
[[ -f "$config_file" ]] && source "$config_file" || true
|
|
||||||
}
|
|
||||||
|
|
||||||
# param_args parses CLI arguments into podman run options.
|
|
||||||
param_args() {
|
|
||||||
while (($# > 0)); do
|
|
||||||
case "$1" in
|
|
||||||
-gpu) run_opts+=("--device" "/dev/dri") ;;
|
|
||||||
-host-spawn) run_opts+=("-v" "/run/user/$UID/bus:/tmp/bus" "-e" "HOST_HOME=$HOME") ;;
|
|
||||||
-container-sock) run_opts+=("-v" "$XDG_RUNTIME_DIR/podman/podman.sock:/var/run/docker.sock") ;;
|
|
||||||
-x11) run_opts+=("-v" "/tmp/.X11-unix:/tmp/.X11-unix" "-v" "$XAUTHORITY:/run/user/1000/.Xauthority:ro" "-e" "DISPLAY=$DISPLAY" "-e" "XAUTHORITY=/run/user/1000/.Xauthority") ;;
|
|
||||||
-mnt) shift && run_opts+=("-w" "/mnt/" "-v" "$1:/mnt/$([[ -d "$1" ]] || echo "file")") ;;
|
|
||||||
*) run_opts+=("$1") ;;
|
|
||||||
esac
|
|
||||||
shift
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
main() {
|
|
||||||
local state_file="$HOME/.local/share/devc-previous-container"
|
|
||||||
local image="${1:-}"
|
|
||||||
|
|
||||||
# Resolve container name (CLI arg > Last used > Error).
|
|
||||||
if [[ $image && $image != -* ]]; then
|
|
||||||
shift
|
|
||||||
[[ $image != *:* ]] && image+=":main"
|
|
||||||
echo "$image" >"$state_file"
|
|
||||||
elif [[ -f $state_file ]]; then
|
|
||||||
image=$(<$state_file)
|
|
||||||
else
|
|
||||||
die "no container name specified"
|
|
||||||
fi
|
|
||||||
local name="${image%:*}"
|
|
||||||
|
|
||||||
# Start/Restart if not running or if arguments change configuration.
|
|
||||||
if [[ -z "$(podman ps -q -f name="^$name$" -f status=running)" ]] || (($# > 0)); then
|
|
||||||
log "starting $image..."
|
|
||||||
|
|
||||||
default_args
|
|
||||||
param_args "$@"
|
|
||||||
|
|
||||||
[[ -n "${DEVC_REGISTRY:-}" ]] || die "registry unknown; set the DEVC_REGISTRY environment variable"
|
|
||||||
podman run --replace --stop-timeout 0 -td "${run_opts[@]}" "$DEVC_REGISTRY/$image"
|
|
||||||
fi
|
|
||||||
|
|
||||||
exec podman exec --detach-keys "ctrl-@,ctrl-@" -it "$name" ${DEVC_COMMAND:-bash -l}
|
|
||||||
}
|
|
||||||
|
|
||||||
main "$@"
|
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# =============================================== #
|
||||||
|
# enter.sh v1.0; job79 #
|
||||||
|
# Enter into an existing or new dev container and #
|
||||||
|
# automatically handle dev container updates. #
|
||||||
|
# =============================================== #
|
||||||
|
set -eu
|
||||||
|
log() { printf '\e[%sm%s\e[0m %s\n' "${3:-36}" "${2:-○}" "$1"; }
|
||||||
|
arg() { echo -n " $@"; }
|
||||||
|
|
||||||
|
# run_args returns the arguments required for the podman run
|
||||||
|
# command.
|
||||||
|
run_args() {
|
||||||
|
arg "--name $name"
|
||||||
|
|
||||||
|
# Disable some security settings to make it possible to
|
||||||
|
# mount host directories without problems.
|
||||||
|
arg "--security-opt label=disable" # disable labeling so mounts don't need to be labeled.
|
||||||
|
arg "--userns=keep-id" # required for ~/.ssh which is usually 700.
|
||||||
|
|
||||||
|
# Use host networking.
|
||||||
|
arg "--net=host"
|
||||||
|
|
||||||
|
# Mount the wayland socket. Required to get the system
|
||||||
|
# clipbard (wl-copy) working.
|
||||||
|
[ -e "/run/user/$UID/wayland-0" ] && arg "-v /run/user/$UID/wayland-0:/run/user/1000/wayland-0"
|
||||||
|
|
||||||
|
# Mount the ssh socket, directory and the git config
|
||||||
|
# directory. This gets the host ssh and git configuration
|
||||||
|
# working inside the container.
|
||||||
|
[ -e "$SSH_AUTH_SOCK" ] && arg "-v $SSH_AUTH_SOCK:/run/user/1000/ssh-auth-sock"
|
||||||
|
[ -d "$HOME/.ssh" ] && arg "-v $HOME/.ssh:/home/user/.ssh"
|
||||||
|
[ -d "$HOME/.config/git" ] && arg "-v $HOME/.config/git:/home/user/.config/git"
|
||||||
|
|
||||||
|
# Mount host directories with programming projects.
|
||||||
|
[ -d "$HOME/Documents" ] && arg "-v $HOME/Documents:/home/user/Documents"
|
||||||
|
[ -d "$HOME/.local/share/devcontainer" ] && arg "-v $HOME/.local/share/devcontainer:/home/user/.dev"
|
||||||
|
|
||||||
|
# Add volumes for .local and .cache so these survive
|
||||||
|
# container restarts.
|
||||||
|
arg "-v $name-local:/home/user/.local"
|
||||||
|
arg "-v $name-cache:/home/user/.cache"
|
||||||
|
}
|
||||||
|
|
||||||
|
### MAIN ###
|
||||||
|
name="dev"
|
||||||
|
image="git.plabble.org/job79/dev:latest"
|
||||||
|
fetch=false
|
||||||
|
|
||||||
|
while test $# -gt 0; do
|
||||||
|
case "$1" in
|
||||||
|
--image | -i) shift && fetch=true && image="$1" ;;
|
||||||
|
--fetch | -f) fetch=true ;;
|
||||||
|
-*) log "unknown argument '$1'" 'x' 31 ;;
|
||||||
|
*) name="$1" ;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ "$fetch" = true ] || [ "$(podman container inspect "$name" -f {{.State.Running}} 2>&1)" != 'true' ]; then
|
||||||
|
log "fetching updates..."
|
||||||
|
if [ "$(podman pull -q "$image")" != "$(podman container inspect "$name" -f {{.Image}} 2>&1)" ]; then
|
||||||
|
log "container image downloaded" '✓' 32
|
||||||
|
podman container rm -f -t 1 "$name" 1>/dev/null
|
||||||
|
podman run -td $(run_args) "$image"
|
||||||
|
else
|
||||||
|
log "no updates available" '✓' 32
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
podman start "$name" 1>/dev/null
|
||||||
|
podman exec --detach-keys "" -it "$name" bash -l
|
||||||
Reference in New Issue
Block a user