Compare commits
18 Commits
main
...
6acfe407ba
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6acfe407ba | ||
|
|
3a50fff009 | ||
|
|
212463c725 | ||
|
|
baad26211e | ||
|
|
8be0e326ca | ||
|
|
f230389825 | ||
|
|
2d111c34a7 | ||
|
|
f0a71e9d47 | ||
|
|
a3abeb44d7 | ||
|
|
b039e28166 | ||
|
|
78ceec4906 | ||
|
|
6e64e2237b | ||
|
|
4db483e992 | ||
|
|
785f2aa857 | ||
|
|
0aba432076 | ||
|
|
cd129f21f7 | ||
|
|
8a47711c61 | ||
|
|
778ee0a2a6 |
@@ -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
|
|
||||||
65
.gitea/workflows/fedora.yaml
Normal file
65
.gitea/workflows/fedora.yaml
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
name: Build container
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: ["main"]
|
||||||
|
paths:
|
||||||
|
- "containers/fedora/**"
|
||||||
|
- "containers/dotnet/**"
|
||||||
|
- "containers/rust/**"
|
||||||
|
- "containers/php/**"
|
||||||
|
- ".gitea/workflows/fedora.yaml"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
fedora-build:
|
||||||
|
runs-on: job-latest
|
||||||
|
steps:
|
||||||
|
- name: Clone repo
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Setup Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
- 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 Fedora container
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: ./containers/fedora
|
||||||
|
file: ./containers/fedora/Containerfile
|
||||||
|
push: true
|
||||||
|
tags: git.plabble.org/maurice/fedora:${{ github.ref_name }}
|
||||||
|
build-args: TAG=${{ github.ref_name }}
|
||||||
|
outputs: type=image,oci-mediatypes=true,compression=zstd,compression-level=3,force-compression=true
|
||||||
|
|
||||||
|
# - name: Build and push Rust container
|
||||||
|
# uses: docker/build-push-action@v5
|
||||||
|
# with:
|
||||||
|
# context: ./containers/rust
|
||||||
|
# file: ./containers/rust/Containerfile
|
||||||
|
# push: true
|
||||||
|
# tags: git.plabble.org/maurice/rust:${{ github.ref_name }}
|
||||||
|
# build-args: TAG=${{ github.ref_name }}
|
||||||
|
# outputs: type=image,oci-mediatypes=true,compression=zstd,compression-level=3,force-compression=true
|
||||||
|
|
||||||
|
- name: Build and push PHP container
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: ./containers/php
|
||||||
|
file: ./containers/php/Containerfile
|
||||||
|
push: true
|
||||||
|
tags: git.plabble.org/maurice/php:${{ github.ref_name }}
|
||||||
|
build-args: TAG=${{ github.ref_name }}
|
||||||
|
outputs: type=image,oci-mediatypes=true,compression=zstd,compression-level=3,force-compression=true
|
||||||
|
|
||||||
|
# - name: Build and push C# container
|
||||||
|
# uses: docker/build-push-action@v5
|
||||||
|
# with:
|
||||||
|
# context: ./containers/dotnet
|
||||||
|
# file: ./containers/dotnet/Containerfile
|
||||||
|
# push: true
|
||||||
|
# tags: git.plabble.org/maurice/dotnet:${{ github.ref_name }}
|
||||||
|
# build-args: TAG=${{ github.ref_name }}
|
||||||
|
# outputs: type=image,oci-mediatypes=true,compression=zstd,compression-level=3,force-compression=true
|
||||||
48
.gitea/workflows/other.yaml
Normal file
48
.gitea/workflows/other.yaml
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
name: Build optional dev containers
|
||||||
|
on:
|
||||||
|
workflow_dispatch: # This makes the workflow manually triggered
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
fedora-build:
|
||||||
|
runs-on: job-latest
|
||||||
|
steps:
|
||||||
|
- name: Clone repo
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Setup Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
- 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 Rider container
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: ./containers/rider
|
||||||
|
file: ./containers/rider/Containerfile
|
||||||
|
push: true
|
||||||
|
tags: git.plabble.org/maurice/rider:${{ github.ref_name }}
|
||||||
|
build-args: TAG=${{ github.ref_name }}
|
||||||
|
outputs: type=image,oci-mediatypes=true,compression=zstd,compression-level=3,force-compression=true
|
||||||
|
|
||||||
|
- name: Build and push Android Studio container
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: ./containers/android
|
||||||
|
file: ./containers/android/Containerfile
|
||||||
|
push: true
|
||||||
|
tags: git.plabble.org/maurice/android:${{ github.ref_name }}
|
||||||
|
build-args: TAG=${{ github.ref_name }}
|
||||||
|
outputs: type=image,oci-mediatypes=true,compression=zstd,compression-level=3,force-compression=true
|
||||||
|
|
||||||
|
- name: Build and push Flutter container
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: ./containers/flutter
|
||||||
|
file: ./containers/flutter/Containerfile
|
||||||
|
push: true
|
||||||
|
tags: git.plabble.org/maurice/flutter:${{ github.ref_name }}
|
||||||
|
build-args: TAG=${{ github.ref_name }}
|
||||||
|
outputs: type=image,oci-mediatypes=true,compression=zstd,compression-level=3,force-compression=true
|
||||||
18
containers/android/Containerfile
Normal file
18
containers/android/Containerfile
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
FROM git.plabble.org/maurice/dotnet:main
|
||||||
|
ARG studio_version="2025.1.4.8"
|
||||||
|
ARG download_uri="https://redirector.gvt1.com/edgedl/android/studio/ide-zips/${studio_version}/android-studio-${studio_version}-linux.tar.gz"
|
||||||
|
|
||||||
|
USER root
|
||||||
|
RUN dnf -y install libXext libXrender libXtst libX11 freetype freetype-devel mesa-libGLU
|
||||||
|
USER user
|
||||||
|
|
||||||
|
RUN curl -Lo /tmp/studio.tar.gz "${download_uri}" && \
|
||||||
|
mkdir /home/user/AndroidStudio && \
|
||||||
|
mkdir /home/user/Android && \
|
||||||
|
tar -zxf /tmp/studio.tar.gz -C /home/user/AndroidStudio && \
|
||||||
|
rm /tmp/studio.tar.gz && \
|
||||||
|
mv /home/user/AndroidStudio/android-studio*/* /home/user/AndroidStudio
|
||||||
|
|
||||||
|
RUN echo 'alias studio="$HOME/AndroidStudio/bin/studio"' >> /home/user/.bashrc
|
||||||
|
RUN echo 'export ANDROID_HOME="$HOME/Android/Sdk"' >> /home/user/.bashrc
|
||||||
|
RUN echo 'export PATH="$ANDROID_HOME/platform-tools:$PATH"' >> /home/user/.bashrc
|
||||||
@@ -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
|
|
||||||
10
containers/dotnet/Containerfile
Normal file
10
containers/dotnet/Containerfile
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
FROM git.plabble.org/maurice/fedora:main
|
||||||
|
|
||||||
|
USER root
|
||||||
|
RUN dnf -y install dotnet-sdk-9.0
|
||||||
|
|
||||||
|
COPY install-roslyn.sh /tmp/install-roslyn.sh
|
||||||
|
RUN chmod +x /tmp/install-roslyn.sh && /tmp/install-roslyn.sh
|
||||||
|
|
||||||
|
USER user
|
||||||
|
RUN dotnet tool install --global dotnet-ef
|
||||||
9
containers/dotnet/install-roslyn.sh
Normal file
9
containers/dotnet/install-roslyn.sh
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
version="v1.39.15-beta.60"
|
||||||
|
arch="linux-x64"
|
||||||
|
link="https://github.com/OmniSharp/omnisharp-roslyn/releases/download/$version/omnisharp-$arch-net6.0.tar.gz"
|
||||||
|
|
||||||
|
curl -Lo /tmp/omnisharp.tar.gz $link
|
||||||
|
mkdir /home/user/.omnisharp
|
||||||
|
tar -zxf /tmp/omnisharp.tar.gz -C /home/user/.omnisharp/
|
||||||
|
chown -R user:user /home/user/.omnisharp
|
||||||
31
containers/fedora/Containerfile
Normal file
31
containers/fedora/Containerfile
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
FROM quay.io/fedora/fedora:43
|
||||||
|
|
||||||
|
# === install system packages ===
|
||||||
|
RUN dnf update -y && \
|
||||||
|
dnf copr enable -y atim/lazygit && \
|
||||||
|
dnf -y install procps ping bash-completion glibc-langpack-en \
|
||||||
|
host-spawn dbus-launch \
|
||||||
|
git pnpm helix zip
|
||||||
|
|
||||||
|
# === setup user ===
|
||||||
|
RUN useradd -ms /bin/bash user && \
|
||||||
|
usermod -aG wheel user && sed -i '/NOPASSWD/s/^#//g' /etc/sudoers && \
|
||||||
|
mkdir -p /run/user/1000 && chown user:user /run/user/1000
|
||||||
|
|
||||||
|
# === Add host entry for podman ===
|
||||||
|
RUN ln -s /usr/local/bin/host /usr/local/bin/podman
|
||||||
|
|
||||||
|
USER user
|
||||||
|
WORKDIR /home/user
|
||||||
|
RUN mkdir .config .local .cache
|
||||||
|
|
||||||
|
COPY --chown=user:user config/bashrc .bashrc
|
||||||
|
COPY --chown=user:user config/git .config/git/config
|
||||||
|
COPY --chown=user:user config/helix/ .config/helix/
|
||||||
|
COPY config/bin /usr/local/bin
|
||||||
|
|
||||||
|
# === Setup PNPM & install language servers ===
|
||||||
|
RUN /bin/bash -c "SHELL=/bin/bash pnpm setup && . /home/user/.bashrc && pnpm i -g deno bash-language-server vscode-langservers-extracted dockerfile-language-server-nodejs \
|
||||||
|
typescript typescript-language-server"
|
||||||
|
|
||||||
|
VOLUME /home/user
|
||||||
2
containers/fedora/config.sh
Normal file
2
containers/fedora/config.sh
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
arg "-p 8080:8080"
|
||||||
22
containers/fedora/config/bashrc
Normal file
22
containers/fedora/config/bashrc
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
. /etc/bashrc
|
||||||
|
|
||||||
|
# === environment ===
|
||||||
|
export EDITOR=hx \
|
||||||
|
WAYLAND_DISPLAY=wayland-0 \
|
||||||
|
XDG_RUNTIME_DIR=/run/user/1000 \
|
||||||
|
SSH_AUTH_SOCK=/run/user/1000/ssh-auth-sock \
|
||||||
|
PS1="\[\e[30;46m\] \h | \w \[\e[0;36m\]\[\e[m\] " \
|
||||||
|
TZ="Europe/Amsterdam" \
|
||||||
|
SHELL="/bin/bash"
|
||||||
|
|
||||||
|
# === aliases and functions ===
|
||||||
|
pbcopy() { curl -sF "content=<-" "https://paste.plabble.org/$2?lang=$1" && echo; }
|
||||||
|
alias random="cat /dev/urandom | tr -dc '[:alpha:]' | fold -w ${1:-20} | head -n 1"
|
||||||
|
|
||||||
|
# Git aliases
|
||||||
|
alias gc="git commit -m"
|
||||||
|
alias ga="git add -A"
|
||||||
|
alias gf="git fetch"
|
||||||
|
alias gp="git pull"
|
||||||
|
alias gpp="git push"
|
||||||
|
alias gs="git status"
|
||||||
4
containers/fedora/config/bin/host
Executable file
4
containers/fedora/config/bin/host
Executable file
@@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
export DBUS_SESSION_BUS_ADDRESS=unix:path=/tmp/bus
|
||||||
|
host-spawn -cwd "${PWD/#$HOME/$HOST_HOME}" \
|
||||||
|
$([ "$(basename "$0")" != "host" ] && echo "$(basename "$0")") "$@"
|
||||||
12
containers/fedora/config/git
Normal file
12
containers/fedora/config/git
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
[user]
|
||||||
|
email = maurict@pm.me
|
||||||
|
name = Maurice
|
||||||
|
signingKey = ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGL/am4HDyfV0OWwaI3CeKGypBdzNXOYSbcnm6tK/VB+ maurict@pm.me
|
||||||
|
[gpg]
|
||||||
|
format = ssh
|
||||||
|
[commit]
|
||||||
|
gpgSign = true
|
||||||
|
[push]
|
||||||
|
autoSetupRemote = true
|
||||||
|
[init]
|
||||||
|
defaultBranch = main
|
||||||
7
containers/fedora/config/helix/config.toml
Normal file
7
containers/fedora/config/helix/config.toml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
theme = "dark_plus"
|
||||||
|
|
||||||
|
[editor]
|
||||||
|
true-color = true
|
||||||
|
|
||||||
|
[editor.file-picker]
|
||||||
|
hidden = false
|
||||||
12
containers/fedora/config/helix/languages.toml
Normal file
12
containers/fedora/config/helix/languages.toml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
# C#
|
||||||
|
[language-server.omnisharp]
|
||||||
|
command = "/home/user/.omnisharp/OmniSharp"
|
||||||
|
args = [ "--languageserver" ]
|
||||||
|
|
||||||
|
# Rust
|
||||||
|
[language-server.rust-analyzer.config.check]
|
||||||
|
command = "clippy"
|
||||||
|
|
||||||
|
[[language]]
|
||||||
|
name = "rust"
|
||||||
|
formatter = { command = "rustfmt" }
|
||||||
11
containers/flutter/Containerfile
Normal file
11
containers/flutter/Containerfile
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
FROM git.plabble.org/maurice/android:main
|
||||||
|
ARG flutter_version="3.35.7-stable"
|
||||||
|
ARG download_uri="https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_${flutter_version}.tar.xz"
|
||||||
|
|
||||||
|
RUN mkdir /home/user/Flutter && \
|
||||||
|
curl -Lo /tmp/flutter.tar.xz "${download_uri}" && \
|
||||||
|
tar -xf /tmp/flutter.tar.xz -C /home/user/Flutter && \
|
||||||
|
rm /tmp/flutter.tar.xz
|
||||||
|
|
||||||
|
RUN echo 'export PATH="$HOME/Flutter/flutter/bin:$PATH"' >> /home/user/.bashrc
|
||||||
|
RUN echo 'export FLUTTER_ROOT="$HOME/Flutter/flutter"' >> /home/user/.bashrc
|
||||||
@@ -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 +1,4 @@
|
|||||||
ARG TAG
|
FROM git.plabble.org/maurice/fedora:main
|
||||||
FROM job79/base:${TAG}
|
ARG php_version="8.4"
|
||||||
USER root
|
|
||||||
|
|
||||||
RUN --mount=type=cache,id=dnf-cache,target=/var/cache/libdnf5 \
|
RUN /bin/bash -c "export TERM=xterm && $(curl -fsSL https://php.new/install/linux/${php_version})"
|
||||||
dnf -y --setopt=keepcache=1 install php composer npm && \
|
|
||||||
composer global require laravel/installer
|
|
||||||
|
|
||||||
USER user
|
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
run_opts+=("-v" "$HOME/Documents/php:/home/user/Documents/php")
|
arg "--cap-add=NET_BIND_SERVICE -p 80:80"
|
||||||
|
|||||||
15
containers/rider/Containerfile
Normal file
15
containers/rider/Containerfile
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
FROM git.plabble.org/maurice/dotnet:main
|
||||||
|
ARG rider_version="2025.2.4"
|
||||||
|
ARG download_uri="https://download.jetbrains.com/rider/JetBrains.Rider-${rider_version}.tar.gz"
|
||||||
|
|
||||||
|
USER root
|
||||||
|
RUN dnf -y install libXext libXrender libXtst libX11 freetype freetype-devel
|
||||||
|
USER user
|
||||||
|
|
||||||
|
RUN curl -Lo /tmp/rider.tar.gz "${download_uri}" && \
|
||||||
|
mkdir /home/user/Rider && \
|
||||||
|
tar -zxf /tmp/rider.tar.gz -C /home/user/Rider && \
|
||||||
|
rm /tmp/rider.tar.gz && \
|
||||||
|
mv /home/user/Rider/JetBrains*/* /home/user/Rider
|
||||||
|
|
||||||
|
RUN echo 'alias rider="$HOME/Rider/bin/rider"' >> /home/user/.bashrc
|
||||||
3
containers/rider/config.sh
Normal file
3
containers/rider/config.sh
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
arg "-p 8080:8080"
|
||||||
|
arg "-p 8081:8081"
|
||||||
4
containers/rust/Containerfile
Normal file
4
containers/rust/Containerfile
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
FROM git.plabble.org/maurice/fedora:main
|
||||||
|
|
||||||
|
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
||||||
|
RUN . '/home/user/.cargo/env' && rustup component add rust-analyzer
|
||||||
158
devc.sh
158
devc.sh
@@ -1,78 +1,124 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# =============================================== #
|
# =============================================== #
|
||||||
# devc.sh v2.1; job79, maurice #
|
# devc.sh v2.0; job79, maurice #
|
||||||
# Dev container entry script. #
|
# Dev container enter script. Handles setting up #
|
||||||
|
# different dev containers, resuming sessions and #
|
||||||
|
# automatic container updates. #
|
||||||
# =============================================== #
|
# =============================================== #
|
||||||
set -euo pipefail
|
set -eu
|
||||||
log() { echo -e "\e[36m○\e[0m $1"; }
|
log() { printf '\e[%sm%s\e[0m %s\n' "${3:-36}" "${2:-○}" "$1"; }
|
||||||
die() { echo -e "\e[31mx\e[0m $1" && exit 1; }
|
arg() { echo -n " $@"; }
|
||||||
|
|
||||||
# default_args configures standard container options.
|
# run_args returns the podman run arguments required for
|
||||||
|
# starting a new container.
|
||||||
default_args() {
|
default_args() {
|
||||||
run_opts+=(
|
arg "--name $name"
|
||||||
"--name" "$name"
|
arg "--hostname $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.
|
# Pull newer container image if available.
|
||||||
[[ -d /sys/fs/selinux ]] && run_opts+=("--security-opt" "label=disable")
|
arg "--pull=newer"
|
||||||
|
|
||||||
# Desktop integration (Wayland, SSH).
|
# Use keep-id so the container user matches the host user.
|
||||||
[[ -e "/run/user/$UID/wayland-0" ]] && run_opts+=("-v" "/run/user/$UID/wayland-0:/run/user/1000/wayland-0")
|
arg "--userns=keep-id"
|
||||||
[[ -e "${SSH_AUTH_SOCK:-}" ]] && run_opts+=("-v" "$SSH_AUTH_SOCK:/run/user/1000/ssh-auth-sock")
|
|
||||||
|
|
||||||
# Load custom container config.
|
# Disable selinux labeling so unix sockets can be mounted
|
||||||
local config_file="${BASH_SOURCE[0]%/*}/containers/$name/config.sh"
|
# without problems.
|
||||||
[[ -f "$config_file" ]] && source "$config_file" || true
|
arg "--security-opt label=disable"
|
||||||
|
|
||||||
|
# Mount the wayland socket. Required to get the system
|
||||||
|
# clipboard (wl-copy) and gui applications working.
|
||||||
|
[ -e "/run/user/$UID/wayland-0" ] && arg "-v /run/user/$UID/wayland-0:/run/user/1000/wayland-0"
|
||||||
|
|
||||||
|
# Mount the ssh socket to get ssh working.
|
||||||
|
[ -e "$SSH_AUTH_SOCK" ] && arg "-v $SSH_AUTH_SOCK:/run/user/1000/ssh-auth-sock"
|
||||||
|
|
||||||
|
# Make the user home dir a volume so it survives container
|
||||||
|
# restarts. Use copy to keep the files from the image.
|
||||||
|
arg "-v $name:/home/user:copy"
|
||||||
|
|
||||||
|
# If there is custom configuration for the container, load
|
||||||
|
# it here.
|
||||||
|
config_file="$(dirname "$(realpath "$0")")/containers/$name/config.sh"
|
||||||
|
[ -f "$config_file" ] && source "${config_file}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# param_args parses CLI arguments into podman run options.
|
# param_args returns the podman run arguments based on the
|
||||||
|
# arguments provided to this script.
|
||||||
param_args() {
|
param_args() {
|
||||||
while (($# > 0)); do
|
while test $# -gt 0; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
-gpu) run_opts+=("--device" "/dev/dri") ;;
|
-gpu) # Enable gpu acceleration.
|
||||||
-host-spawn) run_opts+=("-v" "/run/user/$UID/bus:/tmp/bus" "-e" "HOST_HOME=$HOME") ;;
|
arg "--device /dev/dri" ;;
|
||||||
-container-sock) run_opts+=("-v" "$XDG_RUNTIME_DIR/podman/podman.sock:/var/run/docker.sock") ;;
|
-kvm) # Enable KVM
|
||||||
-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") ;;
|
arg "--device /dev/kvm" ;;
|
||||||
-mnt) shift && run_opts+=("-w" "/mnt/" "-v" "$1:/mnt/$([[ -d "$1" ]] || echo "file")") ;;
|
-usb) # Enable USB access
|
||||||
*) run_opts+=("$1") ;;
|
arg "--device /dev/bus/usb" ;;
|
||||||
|
-host-spawn) # Enable spawning host commands from inside the container using host-spawn.
|
||||||
|
arg "-v /run/user/$UID/bus:/tmp/bus"
|
||||||
|
arg "-e HOST_HOME=$HOME" # Used to translate paths.
|
||||||
|
;;
|
||||||
|
-net) # Enable network dev-<container name>
|
||||||
|
arg "--network dev-$name"
|
||||||
|
;;
|
||||||
|
-mnt) # Mount directory.
|
||||||
|
shift
|
||||||
|
arg "-w /workdir/"
|
||||||
|
arg "-v $1:/workdir/$([ ! -d "$1" ] && echo $1)"
|
||||||
|
;;
|
||||||
|
-mdf) # Mount dev folder
|
||||||
|
arg "-v $HOME/dev:/home/user/dev"
|
||||||
|
;;
|
||||||
|
-x11) # Enable X11 support.
|
||||||
|
arg "-v /tmp/.X11-unix:/tmp/.X11-unix"
|
||||||
|
arg "-v $XAUTHORITY:/run/user/1000/.Xauthority:ro"
|
||||||
|
arg "-e DISPLAY=$DISPLAY"
|
||||||
|
arg "-e XAUTHORITY=/run/user/1000/.Xauthority"
|
||||||
|
;;
|
||||||
|
*) # Use unknown arguments a podman arguments.
|
||||||
|
arg "$1" ;;
|
||||||
esac
|
esac
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
main() {
|
### MAIN ###
|
||||||
local state_file="$HOME/.local/share/devc-previous-container"
|
# Get the devcontainer name from the first argument. If not
|
||||||
local image="${1:-}"
|
# provided, use the last used name when possible.
|
||||||
|
if [[ $# -gt 0 ]] && [[ ${1:-} != -* ]]; then
|
||||||
# Resolve container name (CLI arg > Last used > Error).
|
image="$1"
|
||||||
if [[ $image && $image != -* ]]; then
|
[[ "$image" != *:* ]] && image="$image:main"
|
||||||
|
echo "$image" >"$HOME/.local/share/devc-previous-container"
|
||||||
shift
|
shift
|
||||||
[[ $image != *:* ]] && image+=":main"
|
elif [ -f "$HOME/.local/share/devc-previous-container" ]; then
|
||||||
echo "$image" >"$state_file"
|
image=$(<"$HOME/.local/share/devc-previous-container")
|
||||||
elif [[ -f $state_file ]]; then
|
else
|
||||||
image=$(<$state_file)
|
log "no container name specified" 'x' 31
|
||||||
else
|
exit 1
|
||||||
die "no container name specified"
|
fi
|
||||||
fi
|
name="${image%:*}"
|
||||||
local name="${image%:*}"
|
|
||||||
|
|
||||||
# Start/Restart if not running or if arguments change configuration.
|
# Get container registry from the DEVC_REGISTRY env
|
||||||
if [[ -z "$(podman ps -q -f name="^$name$" -f status=running)" ]] || (($# > 0)); then
|
# variable.
|
||||||
log "starting $image..."
|
if [ -n "${DEVC_REGISTRY:-}" ]; then
|
||||||
|
registry="$DEVC_REGISTRY"
|
||||||
|
else
|
||||||
|
log "registry unknown; set the DEVC_REGISTRY environment variable" 'x' 31
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
default_args
|
# Get container command from the DEVC_COMMAND env variable
|
||||||
param_args "$@"
|
# if set, else use bash -l.
|
||||||
|
if [ -z "${DEVC_COMMAND:-}" ]; then
|
||||||
|
DEVC_COMMAND="bash -l"
|
||||||
|
fi
|
||||||
|
|
||||||
[[ -n "${DEVC_REGISTRY:-}" ]] || die "registry unknown; set the DEVC_REGISTRY environment variable"
|
# When container is not running or arguments are provided,
|
||||||
podman run --replace --stop-timeout 0 -td "${run_opts[@]}" "$DEVC_REGISTRY/$image"
|
# recreate it.
|
||||||
fi
|
if [ "$(podman container inspect "$name" -f {{.State.Running}} 2>&1)" != 'true' ] || [[ $# -gt 0 ]]; then
|
||||||
|
log "starting devcontainer..."
|
||||||
|
podman network create --ignore "dev-$name"
|
||||||
|
podman container rm -f -t 0 "$name" 1>/dev/null
|
||||||
|
podman run -td $(default_args) $(param_args $@) "$registry/$image"
|
||||||
|
fi
|
||||||
|
|
||||||
exec podman exec --detach-keys "ctrl-@,ctrl-@" -it "$name" ${DEVC_COMMAND:-bash -l}
|
podman exec --detach-keys "ctrl-@" -it "$name" ${DEVC_COMMAND:-}
|
||||||
}
|
|
||||||
|
|
||||||
main "$@"
|
|
||||||
|
|||||||
28
example-bashrc
Normal file
28
example-bashrc
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
# Tools
|
||||||
|
pbcopy() { curl -sF "content=<-" "https://paste.plabble.org/$2?lang=$1" && echo; }
|
||||||
|
alias code="flatpak run com.visualstudio.code"
|
||||||
|
alias random="cat /dev/urandom | tr -dc '[:alpha:]' | fold -w ${1:-20} | head -n 1"
|
||||||
|
|
||||||
|
# Dev containers
|
||||||
|
export DEVC_REGISTRY="git.plabble.org/maurice"
|
||||||
|
|
||||||
|
function devc() {
|
||||||
|
"$HOME/dev/devcontainer/devc.sh" "$@" -mdf
|
||||||
|
}
|
||||||
|
|
||||||
|
alias rider="DEVC_COMMAND=/home/user/Rider/bin/rider devc rider -x11 -host-spawn -net"
|
||||||
|
alias flutter="devc flutter -x11 -host-spawn -kvm -usb -gpu"
|
||||||
|
alias androidstudio="DEVC_COMMAND=/home/user/AndroidStudio/bin/studio devc android -x11 -host-spawn -kvm -usb -gpu"
|
||||||
|
|
||||||
|
function hx() {
|
||||||
|
arg="${1:-.}"
|
||||||
|
DEVC_COMMAND="hx $arg" devc fedora -mnt $arg
|
||||||
|
}
|
||||||
|
|
||||||
|
# Git aliases
|
||||||
|
alias gc="git commit -m"
|
||||||
|
alias ga="git add -A"
|
||||||
|
alias gf="git fetch"
|
||||||
|
alias gp="git pull"
|
||||||
|
alias gpp="git push"
|
||||||
|
alias gs="git status"
|
||||||
Reference in New Issue
Block a user