Compare commits
20 Commits
5ce5004482
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
f8c5a5071d
|
|||
|
12a9bec916
|
|||
|
ccd1cafa80
|
|||
|
06491c1a02
|
|||
|
54534cceab
|
|||
|
b44b0c248c
|
|||
|
bc86a1d58c
|
|||
|
614168c903
|
|||
|
183ccc0072
|
|||
|
8b31b61380
|
|||
|
5f87d970f9
|
|||
|
f96fd2eff5
|
|||
|
3d4c258bb1
|
|||
|
9cd843f749
|
|||
|
18889e3d26
|
|||
|
b3215c96f3
|
|||
|
056ff220c5
|
|||
|
f67738b5ec
|
|||
|
2ca42d5add
|
|||
|
f895c11cbd
|
@@ -66,13 +66,20 @@ jobs:
|
||||
|
||||
dependent-images:
|
||||
needs: [changes, base-image]
|
||||
if: always() && needs.changes.result == 'success' && (needs.base-image.result == 'success' || needs.base-image.result == 'skipped') && (needs.changes.outputs[matrix.container] == 'true' || needs.changes.outputs.any_change == 'true')
|
||||
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
|
||||
|
||||
@@ -3,13 +3,14 @@ FROM quay.io/fedora/fedora:44
|
||||
# === install system packages ===
|
||||
RUN --mount=type=cache,id=dnf-cache,target=/var/cache/libdnf5 \
|
||||
dnf update -y && \
|
||||
dnf copr enable -y atim/lazygit && \
|
||||
dnf copr enable -y atim/lazydocker && \
|
||||
dnf copr enable -y gierth/tools-golang && \
|
||||
dnf copr enable -y agriffis/neovim-nightly && \
|
||||
dnf -y --setopt=keepcache=1 install procps ping bash-completion glibc-langpack-en \
|
||||
host-spawn dbus-launch \
|
||||
zoxide git npm neovim awk jq unzip fd-find lazygit lazydocker lazysql
|
||||
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
|
||||
|
||||
|
||||
@@ -1,17 +1,21 @@
|
||||
source /etc/bashrc
|
||||
|
||||
# === bash settings ===
|
||||
set -o vi
|
||||
bind -m vi-insert '"\C-l": clear-screen'
|
||||
|
||||
# === environment ===
|
||||
export EDITOR="nvim" \
|
||||
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"
|
||||
|
||||
PS1="\[\e[30;46m\] \h | \w \[\e[0;36m\]\[\e[m\] "
|
||||
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 "$(zoxide init --cmd cd bash)"
|
||||
eval "$(fzf --bash)"
|
||||
|
||||
@@ -2,7 +2,9 @@ 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 go
|
||||
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
|
||||
|
||||
@@ -3,7 +3,8 @@ FROM job79/base:${TAG}
|
||||
USER root
|
||||
|
||||
RUN --mount=type=cache,id=dnf-cache,target=/var/cache/libdnf5 \
|
||||
dnf -y --setopt=keepcache=1 install 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")" && \
|
||||
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
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ 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 && \
|
||||
dnf -y --setopt=keepcache=1 install php composer npm && \
|
||||
composer global require laravel/installer
|
||||
|
||||
USER user
|
||||
|
||||
27
devc.sh
27
devc.sh
@@ -4,8 +4,8 @@
|
||||
# Dev container entry script. #
|
||||
# =============================================== #
|
||||
set -euo pipefail
|
||||
log() { printf '\e[%sm%s\e[0m %s\n' "${3:-36}" "${2:-○}" "$1"; }
|
||||
die() { log "$1" 'x' 31 && exit 1; }
|
||||
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() {
|
||||
@@ -14,8 +14,8 @@ default_args() {
|
||||
"--hostname" "$name"
|
||||
"--pull=newer" # Update image.
|
||||
"--userns=keep-id" # Map host user.
|
||||
"--net=devc" # Shared network.
|
||||
"-v" "$name:/home/user:copy" # Persistent home volume.
|
||||
"-v" "dnf-cache:/var/cache/libdnf5" # Cache dnf metadata.
|
||||
)
|
||||
|
||||
# Unix sockets require SELinux label disable.
|
||||
@@ -36,17 +36,9 @@ param_args() {
|
||||
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:-/run/user/$UID}/podman/podman.sock:/var/run/docker.sock") ;;
|
||||
-x11)
|
||||
run_opts+=("-v" "/tmp/.X11-unix:/tmp/.X11-unix" "-v" "${XAUTHORITY:-$HOME/.Xauthority}:/run/user/1000/.Xauthority:ro")
|
||||
run_opts+=("-e" "DISPLAY=${DISPLAY:-:0}" "-e" "XAUTHORITY=/run/user/1000/.Xauthority")
|
||||
;;
|
||||
-mnt)
|
||||
local type=''
|
||||
[[ ! -d "$2" ]] && type='file'
|
||||
run_opts+=("-w" "/mnt/" "-v" "$2:/mnt/$type")
|
||||
shift
|
||||
;;
|
||||
-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
|
||||
@@ -60,8 +52,8 @@ main() {
|
||||
# Resolve container name (CLI arg > Last used > Error).
|
||||
if [[ $image && $image != -* ]]; then
|
||||
shift
|
||||
[[ $image == *:* ]] || image+=":main"
|
||||
mkdir -p "${state_file%/*}" && echo "$image" >"$state_file"
|
||||
[[ $image != *:* ]] && image+=":main"
|
||||
echo "$image" >"$state_file"
|
||||
elif [[ -f $state_file ]]; then
|
||||
image=$(<$state_file)
|
||||
else
|
||||
@@ -72,12 +64,11 @@ main() {
|
||||
# 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..."
|
||||
[[ -n "${DEVC_REGISTRY:-}" ]] || die "registry unknown; set the DEVC_REGISTRY environment variable"
|
||||
|
||||
default_args
|
||||
param_args "$@"
|
||||
|
||||
podman network create --ignore "devc" &>/dev/null
|
||||
[[ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user