Compare commits
17
Commits
37459cb415
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fe5891b4f5
|
||
|
|
2a509299cd
|
||
|
|
d3cd31a723
|
||
|
|
8ac038c8b2
|
||
|
|
27f9c5b92d
|
||
|
|
2c43637271
|
||
|
|
8838a3af4e
|
||
|
|
2dd27f2190
|
||
|
|
c17730973f
|
||
|
|
acba767594
|
||
|
|
47c027025f
|
||
|
|
878c925f12
|
||
|
|
410e6e6410
|
||
|
|
4d657656cd
|
||
|
|
12534d3afd
|
||
|
|
9c6569fa29
|
||
|
|
0397174460
|
No files matched your search
+24
-85
@@ -10,96 +10,35 @@ on:
|
||||
schedule:
|
||||
- cron: "0 16 * * FRI"
|
||||
|
||||
env:
|
||||
REGISTRY: git.plabble.org
|
||||
# Images in build order; later images build FROM the local base image.
|
||||
IMAGES: base web
|
||||
TAG: ${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.number) || github.ref_name }}
|
||||
PUSH: ${{ github.event_name != 'pull_request' }}
|
||||
|
||||
jobs:
|
||||
changes:
|
||||
runs-on: job-v2
|
||||
outputs:
|
||||
any_container_change: ${{ steps.filter.outputs.containers == 'true' || steps.filter.outputs.workflow == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: https://github.com/dorny/paths-filter@v3
|
||||
id: filter
|
||||
with:
|
||||
filters: |
|
||||
workflow: ['.gitea/workflows/build.yaml']
|
||||
containers: ['containers/**']
|
||||
|
||||
base-image:
|
||||
needs: [changes]
|
||||
if: ${{ needs.changes.outputs.any_container_change == 'true' }}
|
||||
build:
|
||||
runs-on: job-v2
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- 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
|
||||
run: |
|
||||
for image in $IMAGES; do
|
||||
pull=never; [[ $image == base ]] && pull=newer
|
||||
buildah build --pull="$pull" \
|
||||
--build-arg TAG="$TAG" \
|
||||
-t "$REGISTRY/job79/$image:$TAG" "containers/$image"
|
||||
done
|
||||
|
||||
- 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: ${{ needs.changes.outputs.any_container_change == 'true' }}
|
||||
runs-on: job-v2
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
container: [infra, go]
|
||||
steps:
|
||||
- name: Clone repo
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- 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/${{ 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
|
||||
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
|
||||
if: env.PUSH == 'true'
|
||||
env:
|
||||
REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }}
|
||||
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
||||
run: |
|
||||
buildah login -u "$REGISTRY_USERNAME" --password-stdin "$REGISTRY" <<<"$REGISTRY_TOKEN"
|
||||
for image in $IMAGES; do
|
||||
buildah push --compression-format=zstd:chunked --compression-level=12 "$REGISTRY/job79/$image:$TAG"
|
||||
done
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
# =============================================== #
|
||||
# devc.sh v2.1; job79, maurice #
|
||||
# devc.sh v2.2; job79, maurice #
|
||||
# Dev container entry script. #
|
||||
# =============================================== #
|
||||
set -euo pipefail
|
||||
@@ -23,11 +23,11 @@ default_args() {
|
||||
|
||||
# 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" "-e" "SSH_AUTH_SOCK=/run/user/1000/ssh-auth-sock")
|
||||
[[ -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
|
||||
local config_file="$(dirname "$(realpath "${BASH_SOURCE[0]}")")/../containers/$name/config.sh"
|
||||
[[ ! -f "$config_file" ]] || source "$config_file"
|
||||
}
|
||||
|
||||
# param_args parses CLI arguments into podman run options.
|
||||
@@ -35,6 +35,7 @@ param_args() {
|
||||
while (($# > 0)); do
|
||||
case "$1" in
|
||||
-gpu) run_opts+=("--device" "/dev/dri") ;;
|
||||
-no-pull) run_opts+=("--pull=never") ;;
|
||||
-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") ;;
|
||||
@@ -59,17 +60,17 @@ main() {
|
||||
else
|
||||
die "no container name specified"
|
||||
fi
|
||||
local name="${image%:*}"
|
||||
local name="${image%:*}" tag="${image#*:}"
|
||||
image="$name" # config.sh may override (e.g. image=base).
|
||||
|
||||
# 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..."
|
||||
log "starting $name:$tag..."
|
||||
|
||||
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"
|
||||
podman run --replace --stop-timeout 0 -td "${run_opts[@]}" "${DEVC_REGISTRY:-git.plabble.org/job79}/$image:$tag"
|
||||
fi
|
||||
|
||||
exec podman exec --detach-keys "ctrl-@,ctrl-@" -it "$name" ${DEVC_COMMAND:-bash -l}
|
||||
|
||||
@@ -2,36 +2,51 @@ FROM quay.io/fedora/fedora:45
|
||||
|
||||
# === install system packages ===
|
||||
RUN --mount=type=cache,id=dnf-cache,target=/var/cache/libdnf5 \
|
||||
curl -fsSL -o /etc/yum.repos.d/neovim-nightly.repo \
|
||||
https://copr.fedorainfracloud.org/coprs/agriffis/neovim-nightly/repo/fedora-45/agriffis-neovim-nightly-fedora-45.repo && \
|
||||
dnf update -y && \
|
||||
dnf -y --setopt=keepcache=1 --setopt=install_weak_deps=False install \
|
||||
bash-completion git-core fzf curl awk jq rg unzip which \
|
||||
host-spawn wl-copy gcc tree-sitter-cli
|
||||
host-spawn wl-copy gcc tree-sitter-cli diffutils procps-ng file patch neovim
|
||||
|
||||
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 && \
|
||||
curl -fsSL https://bun.sh/install | BUN_INSTALL="/usr/local" bash && \
|
||||
ln -sf /usr/local/bin/bun /usr/local/bin/node && \
|
||||
# === install tools (least to most frequently changing) ===
|
||||
RUN set -o pipefail && \
|
||||
curl -fsSL "$(curl -fsSL https://registry.npmjs.org/@oven/bun-linux-x64/latest | jq -r .dist.tarball)" | \
|
||||
tar xz -C /usr/local/bin --strip-components=2 package/bin/bun && \
|
||||
ln -sf bun /usr/local/bin/bunx && \
|
||||
ln -sf bun /usr/local/bin/node
|
||||
|
||||
RUN set -o pipefail && \
|
||||
curl -fsSL https://claude.ai/install.sh | bash && \
|
||||
cp -L /root/.local/bin/claude /usr/local/bin/ && \
|
||||
rm -rf /root/.local
|
||||
|
||||
COPY ./bin /usr/local/bin
|
||||
COPY ./config/claude.md /etc/claude-code/CLAUDE.md
|
||||
COPY ./config/bashrc /etc/profile.d/devc.sh
|
||||
|
||||
# === environment ===
|
||||
ENV EDITOR=nvim \
|
||||
TZ=Europe/Amsterdam \
|
||||
XDG_RUNTIME_DIR=/run/user/1000 \
|
||||
WAYLAND_DISPLAY=wayland-0 \
|
||||
SSH_AUTH_SOCK=/run/user/1000/ssh-auth-sock \
|
||||
DISABLE_AUTOUPDATER=1
|
||||
|
||||
# === 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
|
||||
mkdir -p /run/user/1000 /opt/nvim && \
|
||||
chown user:user /run/user/1000 /opt/nvim
|
||||
|
||||
USER user
|
||||
WORKDIR /home/user
|
||||
|
||||
RUN mkdir -p .config .local .cache && \
|
||||
git clone https://git.plabble.org/Job79/neovim-config.git .config/nvim
|
||||
git clone https://git.plabble.org/Job79/neovim-config.git /opt/nvim && \
|
||||
git -C /opt/nvim remote set-url origin ssh://git@git.plabble.org:2222/Job79/neovim-config.git && \
|
||||
ln -s /opt/nvim .config/nvim
|
||||
|
||||
COPY --chown=user:user ./config/bashrc .bashrc
|
||||
COPY --chown=user:user ./config/git .config/git/config
|
||||
|
||||
VOLUME /home/user
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/bin/bash
|
||||
export DBUS_SESSION_BUS_ADDRESS="unix:path=/tmp/bus"
|
||||
[[ -S /tmp/bus ]] || { echo "host-spawn unavailable: restart with 'devc -host-spawn'" >&2; exit 1; }
|
||||
|
||||
cmd="${0##*/}"
|
||||
[[ "$cmd" == "host" ]] && unset cmd
|
||||
|
||||
@@ -1,12 +1,5 @@
|
||||
source /etc/bashrc
|
||||
|
||||
# === 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"
|
||||
# === prompt ===
|
||||
export PS1="\[\e[30;46m\] \h | \w \[\e[0;36m\]\[\e[m\] "
|
||||
|
||||
# === aliases and functions ===
|
||||
alias vi=nvim
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
# Environment
|
||||
- Fedora dev container (podman); `sudo dnf install -y <pkg>` for missing tools.
|
||||
- `node` is bun; no python3.
|
||||
- `podman` is available; if it errors, ask the user for permission (restart with `devc -host-spawn`).
|
||||
@@ -1,15 +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 && \
|
||||
GOBIN=/usr/local/bin /usr/local/go/bin/go install golang.org/x/tools/gopls@latest && \
|
||||
GOBIN=/usr/local/bin /usr/local/go/bin/go install mvdan.cc/gofumpt@latest && \
|
||||
GOBIN=/usr/local/bin /usr/local/go/bin/go install golang.org/x/tools/cmd/goimports@latest && \
|
||||
GOBIN=/usr/local/bin /usr/local/go/bin/go install github.com/go-delve/delve/cmd/dlv@latest && \
|
||||
BUN_INSTALL="/usr/local" bun install -g typescript typescript-language-server @tailwindcss/language-server svelte-language-server @biomejs/biome
|
||||
|
||||
USER user
|
||||
@@ -1,2 +0,0 @@
|
||||
ARG TAG
|
||||
FROM job79/base:${TAG}
|
||||
@@ -1,2 +1,3 @@
|
||||
#!/bin/bash
|
||||
image=base
|
||||
run_opts+=("-v" "$HOME/Code/infra:/home/user/Code/infra")
|
||||
@@ -0,0 +1,24 @@
|
||||
ARG TAG=main
|
||||
FROM git.plabble.org/job79/base:${TAG}
|
||||
USER root
|
||||
|
||||
RUN set -o pipefail && \
|
||||
GO_VERSION=$(curl -fsSL "https://go.dev/VERSION?m=text" | head -n 1 | tr -d '\r\n') && \
|
||||
curl -fsSL "https://go.dev/dl/${GO_VERSION}.linux-amd64.tar.gz" | tar xz -C /usr/local && \
|
||||
ln -sf /usr/local/go/bin/go /usr/local/go/bin/gofmt /usr/local/bin/
|
||||
|
||||
# Build caches live in cache mounts so they don't end up in the image.
|
||||
RUN --mount=type=cache,id=go-mod,target=/root/go/pkg/mod \
|
||||
--mount=type=cache,id=go-build,target=/root/.cache/go-build \
|
||||
for pkg in \
|
||||
golang.org/x/tools/gopls \
|
||||
golang.org/x/tools/cmd/goimports \
|
||||
mvdan.cc/gofumpt \
|
||||
github.com/go-delve/delve/cmd/dlv; \
|
||||
do GOBIN=/usr/local/bin go install "$pkg@latest" || exit 1; done
|
||||
|
||||
RUN --mount=type=cache,id=bun-cache,target=/root/.bun-cache \
|
||||
BUN_INSTALL=/usr/local BUN_INSTALL_CACHE_DIR=/root/.bun-cache bun install -g \
|
||||
typescript typescript-language-server @tailwindcss/language-server svelte-language-server @biomejs/biome
|
||||
|
||||
USER user
|
||||
File renamed without changes.
Reference in new issue
Block a user