forked from Job79/devcontainer
Compare commits
45 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
5ce5004482
|
|||
|
e643f9974a
|
|||
|
d74f42b7fa
|
|||
|
75e1d916d2
|
|||
|
363355bfe0
|
|||
|
9edab5b046
|
|||
|
b07ae7ea7f
|
|||
|
955b5030e6
|
|||
|
0089c971f4
|
|||
|
16841bb334
|
|||
|
a1f7a46a73
|
|||
|
d8367d41cd
|
|||
|
433846ada7
|
|||
|
67e709b65f
|
|||
|
6d817d31cd
|
|||
|
2f0327fa55
|
|||
|
e2b563270c
|
|||
|
2e8375d34f
|
|||
|
dc2f2991bc
|
|||
|
10f0f5993b
|
|||
|
8f761565d0
|
|||
|
86e3275c67
|
|||
|
e6bd3f3524
|
|||
|
4e1737f5b3
|
|||
|
32bbe1c2cd
|
|||
|
678b8bee6e
|
|||
|
0d3d5d5b36
|
|||
|
8bde490c6d
|
|||
|
cdbb4de204
|
|||
|
9b81bc8c68
|
|||
|
40bb6328c4
|
|||
|
c137f16ddf
|
|||
|
057c72e3a0
|
|||
|
062972a440
|
|||
|
723d2fd984
|
|||
|
03df535d76
|
|||
|
d6ef16cd24
|
|||
|
a0ea04d2bd
|
|||
|
d7468a444b
|
|||
|
f25b6966ef
|
|||
|
9f1b65b781
|
|||
|
d81fa7d3a1
|
|||
|
7e27784a9a
|
|||
|
b5dd280e5a
|
|||
|
bb43c758f9
|
@@ -7,13 +7,18 @@ on:
|
|||||||
pull_request:
|
pull_request:
|
||||||
branches: ["main"]
|
branches: ["main"]
|
||||||
paths: ["containers/**", ".gitea/workflows/build.yaml"]
|
paths: ["containers/**", ".gitea/workflows/build.yaml"]
|
||||||
|
schedule:
|
||||||
|
- cron: "0 16 * * FRI"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
changes:
|
changes:
|
||||||
runs-on: job-v2
|
runs-on: job-v2
|
||||||
outputs:
|
outputs:
|
||||||
any_change: ${{ steps.filter.outputs.workflow == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'}}
|
|
||||||
base: ${{ steps.filter.outputs.base == 'true' }}
|
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:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: https://github.com/dorny/paths-filter@v3
|
- uses: https://github.com/dorny/paths-filter@v3
|
||||||
@@ -22,6 +27,9 @@ jobs:
|
|||||||
filters: |
|
filters: |
|
||||||
workflow: ['.gitea/workflows/build.yaml']
|
workflow: ['.gitea/workflows/build.yaml']
|
||||||
base: ['containers/base/**']
|
base: ['containers/base/**']
|
||||||
|
infra: ['containers/infra/**']
|
||||||
|
go: ['containers/go/**']
|
||||||
|
php: ['containers/php/**']
|
||||||
|
|
||||||
base-image:
|
base-image:
|
||||||
needs: [changes]
|
needs: [changes]
|
||||||
@@ -39,10 +47,11 @@ jobs:
|
|||||||
id: build
|
id: build
|
||||||
uses: job79/buildah-build@65b3793a1370c1ccd74a5c0d090d70eb9637a4ef
|
uses: job79/buildah-build@65b3793a1370c1ccd74a5c0d090d70eb9637a4ef
|
||||||
with:
|
with:
|
||||||
image: maurice/base
|
image: job79/base
|
||||||
tags: ${{ github.ref_name }}
|
tags: ${{ github.ref_name }}
|
||||||
context: ./containers/base
|
context: ./containers/base
|
||||||
containerfiles: ./containers/base/Containerfile
|
containerfiles: ./containers/base/Containerfile
|
||||||
|
platforms: linux/amd64
|
||||||
- name: Push
|
- name: Push
|
||||||
uses: redhat-actions/push-to-registry@v2
|
uses: redhat-actions/push-to-registry@v2
|
||||||
with:
|
with:
|
||||||
@@ -55,51 +64,45 @@ jobs:
|
|||||||
--compression-format=zstd
|
--compression-format=zstd
|
||||||
--compression-level=12
|
--compression-level=12
|
||||||
|
|
||||||
# dependent-images:
|
dependent-images:
|
||||||
# needs: [changes, base-image]
|
needs: [changes, base-image]
|
||||||
# if: always() && needs.changes.result == 'success' && (needs.base-image.result == 'success' || needs.base-image.result == 'skipped')
|
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')
|
||||||
# runs-on: job-v2
|
runs-on: job-v2
|
||||||
# strategy:
|
strategy:
|
||||||
# fail-fast: false
|
fail-fast: false
|
||||||
# matrix:
|
matrix:
|
||||||
# container: [rust, dotnet, go]
|
container: [infra, go, php]
|
||||||
# steps:
|
steps:
|
||||||
# - name: Check if build needed
|
- name: Clone repo
|
||||||
# id: check
|
if: steps.check.outputs.run == 'true'
|
||||||
# run: |
|
uses: actions/checkout@v4
|
||||||
# if [[ "${{ matrix.container }}" == "go" && "${{ needs.changes.outputs.go }}" == "true" ]]; then echo "run=true" >> $GITHUB_OUTPUT; fi
|
- name: Log in
|
||||||
# if [[ "${{ matrix.container }}" == "rust" && "${{ needs.changes.outputs.rust }}" == "true" ]]; then echo "run=true" >> $GITHUB_OUTPUT; fi
|
if: steps.check.outputs.run == 'true'
|
||||||
# if [[ "${{ matrix.container }}" == "dotnet" && "${{ needs.changes.outputs.dotnet }}" == "true" ]]; then echo "run=true" >> $GITHUB_OUTPUT; fi
|
uses: redhat-actions/podman-login@v1
|
||||||
# if [[ "${{ needs.changes.outputs.any_change }}" == "true" ]]; then echo "run=true" >> $GITHUB_OUTPUT; fi
|
with:
|
||||||
# - name: Clone repo
|
registry: git.plabble.org
|
||||||
# if: steps.check.outputs.run == 'true'
|
username: ${{ secrets.REGISTRY_USERNAME }}
|
||||||
# uses: actions/checkout@v4
|
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||||
# - name: Log in
|
- name: Build
|
||||||
# if: steps.check.outputs.run == 'true'
|
id: build
|
||||||
# uses: redhat-actions/podman-login@v1
|
if: steps.check.outputs.run == 'true'
|
||||||
# with:
|
uses: job79/buildah-build@65b3793a1370c1ccd74a5c0d090d70eb9637a4ef
|
||||||
# registry: git.plabble.org
|
with:
|
||||||
# username: ${{ secrets.REGISTRY_USERNAME }}
|
image: job79/${{ matrix.container }}
|
||||||
# password: ${{ secrets.REGISTRY_TOKEN }}
|
tags: ${{ github.ref_name }}
|
||||||
# - name: Build
|
context: ./containers/${{ matrix.container }}
|
||||||
# id: build
|
containerfiles: ./containers/${{ matrix.container }}/Containerfile
|
||||||
# if: steps.check.outputs.run == 'true'
|
build-args: TAG=${{ github.ref_name }}
|
||||||
# uses: job79/buildah-build@65b3793a1370c1ccd74a5c0d090d70eb9637a4ef
|
platforms: linux/amd64
|
||||||
# with:
|
- name: Push
|
||||||
# image: maurice/${{ matrix.container }}
|
if: steps.check.outputs.run == 'true'
|
||||||
# tags: ${{ github.ref_name }}
|
uses: redhat-actions/push-to-registry@v2
|
||||||
# context: ./containers/${{ matrix.container }}
|
with:
|
||||||
# containerfiles: ./containers/${{ matrix.container }}/Containerfile
|
image: ${{ steps.build.outputs.image }}
|
||||||
# build-args: TAG=${{ github.ref_name }}
|
tags: ${{ steps.build.outputs.tags }}
|
||||||
# - name: Push
|
registry: git.plabble.org
|
||||||
# if: steps.check.outputs.run == 'true'
|
username: ${{ secrets.REGISTRY_USERNAME }}
|
||||||
# uses: redhat-actions/push-to-registry@v2
|
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||||
# with:
|
extra-args: |
|
||||||
# image: ${{ steps.build.outputs.image }}
|
--compression-format=zstd
|
||||||
# tags: ${{ steps.build.outputs.tags }}
|
--compression-level=12
|
||||||
# registry: git.plabble.org
|
|
||||||
# username: ${{ secrets.REGISTRY_USERNAME }}
|
|
||||||
# password: ${{ secrets.REGISTRY_TOKEN }}
|
|
||||||
# extra-args: |
|
|
||||||
# --compression-format=zstd
|
|
||||||
# --compression-level=12
|
|
||||||
|
|||||||
@@ -1,40 +0,0 @@
|
|||||||
name: Build optional dev containers
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
fedora-build:
|
|
||||||
runs-on: job-v2
|
|
||||||
strategy:
|
|
||||||
max-parallel: 1
|
|
||||||
matrix:
|
|
||||||
container: [rider]
|
|
||||||
steps:
|
|
||||||
- name: Clone repo
|
|
||||||
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 ${{ matrix.container }} container
|
|
||||||
id: build_image
|
|
||||||
uses: job79/buildah-build@65b3793a1370c1ccd74a5c0d090d70eb9637a4ef
|
|
||||||
with:
|
|
||||||
image: maurice/${{ matrix.container }}
|
|
||||||
tags: ${{ github.ref_name }}
|
|
||||||
context: ./containers/${{ matrix.container }}
|
|
||||||
containerfiles: ./containers/${{ matrix.container }}/Containerfile
|
|
||||||
build-args: TAG=${{ github.ref_name }}
|
|
||||||
- name: Push ${{ matrix.container }} container
|
|
||||||
uses: redhat-actions/push-to-registry@v2
|
|
||||||
with:
|
|
||||||
image: ${{ steps.build_image.outputs.image }}
|
|
||||||
tags: ${{ steps.build_image.outputs.tags }}
|
|
||||||
registry: git.plabble.org
|
|
||||||
username: ${{ secrets.REGISTRY_USERNAME }}
|
|
||||||
password: ${{ secrets.REGISTRY_TOKEN }}
|
|
||||||
extra-args: |
|
|
||||||
--compression-format=zstd
|
|
||||||
--compression-level=12
|
|
||||||
5
build.sh
5
build.sh
@@ -1,5 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
cd containers/base
|
|
||||||
podman build -t git.plabble.org/maurice/base:main .
|
|
||||||
cd ../rider
|
|
||||||
podman build -t git.plabble.org/maurice/rider:main .
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
FROM git.plabble.org/maurice/base:main
|
|
||||||
ARG studio_version="2025.3.2.6"
|
|
||||||
ARG download_uri="https://redirector.gvt1.com/edgedl/android/studio/ide-zips/${studio_version}/android-studio-${studio_version}-linux.tar.gz"
|
|
||||||
|
|
||||||
USER root
|
|
||||||
# === setup GUI ===
|
|
||||||
RUN --mount=type=cache,id=dnf-cache,target=/var/cache/libdnf5 \
|
|
||||||
dnf -y --setopt=keepcache=1 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,53 +1,31 @@
|
|||||||
FROM quay.io/fedora/fedora:43
|
FROM quay.io/fedora/fedora:44
|
||||||
|
|
||||||
# === install system packages ===
|
# === install system packages ===
|
||||||
RUN --mount=type=cache,id=dnf-cache,target=/var/cache/libdnf5 \
|
RUN --mount=type=cache,id=dnf-cache,target=/var/cache/libdnf5 \
|
||||||
dnf update -y && \
|
dnf update -y && \
|
||||||
dnf -y --setopt=keepcache=1 install \
|
dnf copr enable -y atim/lazygit && \
|
||||||
procps ping bash-completion glibc-langpack-en openssl-devel \
|
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 \
|
host-spawn dbus-launch \
|
||||||
git pnpm helix zip rsync \
|
zoxide git npm neovim awk jq unzip fd-find lazygit lazydocker lazysql
|
||||||
dotnet-sdk-10.0
|
|
||||||
|
COPY config/bin /usr/local/bin
|
||||||
|
|
||||||
# === setup user ===
|
# === setup user ===
|
||||||
RUN useradd -ms /bin/bash user && \
|
RUN useradd -ms /bin/bash user && \
|
||||||
usermod -aG wheel user && sed -i '/NOPASSWD/s/^#//g' /etc/sudoers && \
|
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 && \
|
||||||
|
chown user:user /run/user/1000
|
||||||
# === Add host entry for podman ===
|
|
||||||
RUN ln -s /usr/local/bin/host /usr/local/bin/podman
|
|
||||||
|
|
||||||
# === root language servers ===
|
|
||||||
COPY install-roslyn.sh /tmp/install-roslyn.sh
|
|
||||||
RUN chmod +x /tmp/install-roslyn.sh && /tmp/install-roslyn.sh && rm /tmp/omnisharp.tar.gz && rm /tmp/install-roslyn.sh
|
|
||||||
# RUN go install golang.org/x/tools/gopls@latest
|
|
||||||
|
|
||||||
USER user
|
USER user
|
||||||
WORKDIR /home/user
|
WORKDIR /home/user
|
||||||
RUN mkdir .config .local .cache
|
|
||||||
|
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/bashrc .bashrc
|
||||||
COPY --chown=user:user config/git .config/git/config
|
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, tools ===
|
|
||||||
RUN /bin/bash -c ". /home/user/.bashrc && pnpm setup && . /home/user/.bashrc && pnpm i -g deno bash-language-server vscode-langservers-extracted dockerfile-language-server-nodejs \
|
|
||||||
typescript typescript-language-server"
|
|
||||||
|
|
||||||
RUN dotnet tool install --global dotnet-ef && \
|
|
||||||
echo 'export PATH="$PATH:/home/user/.dotnet/tools:/home/user/.cargo/env"' >> /home/user/.bashrc
|
|
||||||
|
|
||||||
# === Rust, WASM toolchain ===
|
|
||||||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
|
||||||
RUN . /home/user/.bashrc && rustup component add rust-analyzer && \
|
|
||||||
curl https://drager.github.io/wasm-pack/installer/init.sh -sSf | sh && \
|
|
||||||
cargo install cargo-generate && \
|
|
||||||
cargo install cargo-expand
|
|
||||||
|
|
||||||
# === Cleanup build dependencies ===
|
|
||||||
USER root
|
|
||||||
RUN dnf remove -y openssl-devel && dnf clean all && rm -rf /home/user/.cargo
|
|
||||||
USER user
|
|
||||||
|
|
||||||
VOLUME /home/user
|
VOLUME /home/user
|
||||||
|
|||||||
@@ -1,22 +1,17 @@
|
|||||||
. /etc/bashrc
|
source /etc/bashrc
|
||||||
|
|
||||||
# === environment ===
|
# === environment ===
|
||||||
export EDITOR=hx \
|
export EDITOR="nvim" \
|
||||||
WAYLAND_DISPLAY=wayland-0 \
|
WAYLAND_DISPLAY="wayland-0" \
|
||||||
XDG_RUNTIME_DIR=/run/user/1000 \
|
XDG_RUNTIME_DIR="/run/user/1000" \
|
||||||
SSH_AUTH_SOCK=/run/user/1000/ssh-auth-sock \
|
SSH_AUTH_SOCK="/run/user/1000/ssh-auth-sock" \
|
||||||
PS1="\[\e[30;46m\] \h | \w \[\e[0;36m\]\[\e[m\] " \
|
TZ="Europe/Amsterdam"
|
||||||
TZ="Europe/Amsterdam" \
|
|
||||||
SHELL="/bin/bash"
|
PS1="\[\e[30;46m\] \h | \w \[\e[0;36m\]\[\e[m\] "
|
||||||
|
|
||||||
# === aliases and functions ===
|
# === aliases and functions ===
|
||||||
pbcopy() { curl -sF "content=<-" "https://paste.plabble.org/$2?lang=$1" && echo; }
|
alias vi=nvim
|
||||||
alias random="cat /dev/urandom | tr -dc '[:alpha:]' | fold -w ${1:-20} | head -n 1"
|
post() { curl -sF "content=<-" "https://paste.plabble.org/$2?lang=$1" && echo; }
|
||||||
|
|
||||||
# Git aliases
|
eval "$(zoxide init --cmd cd bash)"
|
||||||
alias gc="git commit -m"
|
eval "$(fzf --bash)"
|
||||||
alias ga="git add -A"
|
|
||||||
alias gf="git fetch"
|
|
||||||
alias gp="git pull"
|
|
||||||
alias gpp="git push"
|
|
||||||
alias gs="git status"
|
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
export DBUS_SESSION_BUS_ADDRESS=unix:path=/tmp/bus
|
export DBUS_SESSION_BUS_ADDRESS="unix:path=/tmp/bus"
|
||||||
host-spawn -cwd "${PWD/#$HOME/$HOST_HOME}" \
|
|
||||||
$([ "$(basename "$0")" != "host" ] && echo "$(basename "$0")") "$@"
|
cmd="${0##*/}"
|
||||||
|
[[ "$cmd" == "host" ]] && unset cmd
|
||||||
|
exec host-spawn -cwd "${PWD/#$HOME/$HOST_HOME}" ${cmd:+"$cmd"} "$@"
|
||||||
|
|||||||
1
containers/base/config/bin/podman
Symbolic link
1
containers/base/config/bin/podman
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
host
|
||||||
1
containers/base/config/bin/xdg-open
Symbolic link
1
containers/base/config/bin/xdg-open
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
host
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
[user]
|
[user]
|
||||||
email = maurict@pm.me
|
email = job@plabble.org
|
||||||
name = Maurice
|
name = Job79
|
||||||
signingKey = ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGL/am4HDyfV0OWwaI3CeKGypBdzNXOYSbcnm6tK/VB+ maurict@pm.me
|
signingKey = ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPsqM6ABAaCTQZ+llFXD3CXrYYuIHDEnvz8IBbXddYEc job@plabble.org
|
||||||
[gpg]
|
[gpg]
|
||||||
format = ssh
|
format = ssh
|
||||||
[commit]
|
[commit]
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
theme = "dark_plus"
|
|
||||||
|
|
||||||
[editor]
|
|
||||||
true-color = true
|
|
||||||
|
|
||||||
[editor.file-picker]
|
|
||||||
hidden = false
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
# 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" }
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
version="v1.39.15"
|
|
||||||
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
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
FROM git.plabble.org/maurice/base:main
|
|
||||||
ARG flutter_version="3.41.4-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
|
|
||||||
8
containers/go/Containerfile
Normal file
8
containers/go/Containerfile
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
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
|
||||||
|
|
||||||
|
USER user
|
||||||
2
containers/go/config.sh
Normal file
2
containers/go/config.sh
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
run_opts+=("-v" "$HOME/Documents/go:/home/user/Documents/go")
|
||||||
10
containers/infra/Containerfile
Normal file
10
containers/infra/Containerfile
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
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 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
|
||||||
2
containers/infra/config.sh
Normal file
2
containers/infra/config.sh
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
run_opts+=("-v" "$HOME/Documents/infra:/home/user/Documents/infra")
|
||||||
9
containers/php/Containerfile
Normal file
9
containers/php/Containerfile
Normal file
@@ -0,0 +1,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 php composer && \
|
||||||
|
composer global require laravel/installer
|
||||||
|
|
||||||
|
USER user
|
||||||
2
containers/php/config.sh
Normal file
2
containers/php/config.sh
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
run_opts+=("-v" "$HOME/Documents/php:/home/user/Documents/php")
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
FROM git.plabble.org/maurice/base:main
|
|
||||||
ARG rider_version="2025.3.3"
|
|
||||||
ARG download_uri="https://download.jetbrains.com/rider/JetBrains.Rider-${rider_version}.tar.gz"
|
|
||||||
|
|
||||||
USER root
|
|
||||||
|
|
||||||
# === setup GUI ===
|
|
||||||
RUN --mount=type=cache,id=dnf-cache,target=/var/cache/libdnf5 \
|
|
||||||
dnf -y --setopt=keepcache=1 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
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
mkdir -p /tmp/joypet-sockets
|
|
||||||
arg "-p 7777:7777"
|
|
||||||
arg "-v /tmp/joypet-sockets:/var/run/joypet-sockets:Z"
|
|
||||||
156
devc.sh
156
devc.sh
@@ -1,125 +1,87 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# =============================================== #
|
# =============================================== #
|
||||||
# devc.sh v2.0; job79, maurice #
|
# devc.sh v2.1; job79, maurice #
|
||||||
# Dev container enter script. Handles setting up #
|
# Dev container entry script. #
|
||||||
# different dev containers, resuming sessions and #
|
|
||||||
# automatic container updates. #
|
|
||||||
# =============================================== #
|
# =============================================== #
|
||||||
set -eu
|
set -euo pipefail
|
||||||
log() { printf '\e[%sm%s\e[0m %s\n' "${3:-36}" "${2:-○}" "$1"; }
|
log() { printf '\e[%sm%s\e[0m %s\n' "${3:-36}" "${2:-○}" "$1"; }
|
||||||
arg() { echo -n " $@"; }
|
die() { log "$1" 'x' 31 && exit 1; }
|
||||||
|
|
||||||
# run_args returns the podman run arguments required for
|
# default_args configures standard container options.
|
||||||
# starting a new container.
|
|
||||||
default_args() {
|
default_args() {
|
||||||
arg "--name $name"
|
run_opts+=(
|
||||||
arg "--hostname $name"
|
"--name" "$name"
|
||||||
|
"--hostname" "$name"
|
||||||
|
"--pull=newer" # Update image.
|
||||||
|
"--userns=keep-id" # Map host user.
|
||||||
|
"--net=devc" # Shared network.
|
||||||
|
"-v" "$name:/home/user:copy" # Persistent home volume.
|
||||||
|
)
|
||||||
|
|
||||||
# Pull newer container image if available.
|
# Unix sockets require SELinux label disable.
|
||||||
# arg "--pull=newer"
|
[[ -d /sys/fs/selinux ]] && run_opts+=("--security-opt" "label=disable")
|
||||||
|
|
||||||
# Use keep-id so the container user matches the host user.
|
# Desktop integration (Wayland, SSH).
|
||||||
arg "--userns=keep-id"
|
[[ -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")
|
||||||
|
|
||||||
# Disable selinux labeling so unix sockets can be mounted
|
# Load custom container config.
|
||||||
# without problems.
|
local config_file="${BASH_SOURCE[0]%/*}/containers/$name/config.sh"
|
||||||
arg "--security-opt label=disable"
|
[[ -f "$config_file" ]] && source "$config_file" || true
|
||||||
|
|
||||||
# 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 returns the podman run arguments based on the
|
# param_args parses CLI arguments into podman run options.
|
||||||
# arguments provided to this script.
|
|
||||||
param_args() {
|
param_args() {
|
||||||
while test $# -gt 0; do
|
while (($# > 0)); do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
-gpu) # Enable gpu acceleration.
|
-gpu) run_opts+=("--device" "/dev/dri") ;;
|
||||||
arg "--device /dev/dri" ;;
|
-host-spawn) run_opts+=("-v" "/run/user/$UID/bus:/tmp/bus" "-e" "HOST_HOME=$HOME") ;;
|
||||||
-kvm) # Enable KVM
|
-container-sock) run_opts+=("-v" "${XDG_RUNTIME_DIR:-/run/user/$UID}/podman/podman.sock:/var/run/docker.sock") ;;
|
||||||
arg "--device /dev/kvm" ;;
|
-x11)
|
||||||
-usb) # Enable USB access
|
run_opts+=("-v" "/tmp/.X11-unix:/tmp/.X11-unix" "-v" "${XAUTHORITY:-$HOME/.Xauthority}:/run/user/1000/.Xauthority:ro")
|
||||||
arg "--device /dev/bus/usb" ;;
|
run_opts+=("-e" "DISPLAY=${DISPLAY:-:0}" "-e" "XAUTHORITY=/run/user/1000/.Xauthority")
|
||||||
-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>'' and 'devc'
|
-mnt)
|
||||||
arg "--network dev-$name --network devc"
|
local type=''
|
||||||
;;
|
[[ ! -d "$2" ]] && type='file'
|
||||||
-mnt) # Mount directory.
|
run_opts+=("-w" "/mnt/" "-v" "$2:/mnt/$type")
|
||||||
shift
|
shift
|
||||||
arg "-w /workdir/"
|
|
||||||
arg "-v $1:/workdir/$([ ! -d "$1" ] && echo $1)"
|
|
||||||
;;
|
;;
|
||||||
-mdf) # Mount dev folder
|
*) run_opts+=("$1") ;;
|
||||||
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() {
|
||||||
# Get the devcontainer name from the first argument. If not
|
local state_file="$HOME/.local/share/devc-previous-container"
|
||||||
# provided, use the last used name when possible.
|
local image="${1:-}"
|
||||||
if [[ $# -gt 0 ]] && [[ ${1:-} != -* ]]; then
|
|
||||||
image="$1"
|
# Resolve container name (CLI arg > Last used > Error).
|
||||||
[[ "$image" != *:* ]] && image="$image:main"
|
if [[ $image && $image != -* ]]; then
|
||||||
echo "$image" >"$HOME/.local/share/devc-previous-container"
|
|
||||||
shift
|
shift
|
||||||
elif [ -f "$HOME/.local/share/devc-previous-container" ]; then
|
[[ $image == *:* ]] || image+=":main"
|
||||||
image=$(<"$HOME/.local/share/devc-previous-container")
|
mkdir -p "${state_file%/*}" && echo "$image" >"$state_file"
|
||||||
|
elif [[ -f $state_file ]]; then
|
||||||
|
image=$(<$state_file)
|
||||||
else
|
else
|
||||||
log "no container name specified" 'x' 31
|
die "no container name specified"
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
name="${image%:*}"
|
local name="${image%:*}"
|
||||||
|
|
||||||
# Get container registry from the DEVC_REGISTRY env
|
# Start/Restart if not running or if arguments change configuration.
|
||||||
# variable.
|
if [[ -z "$(podman ps -q -f name="^$name$" -f status=running)" ]] || (($# > 0)); then
|
||||||
if [ -n "${DEVC_REGISTRY:-}" ]; then
|
log "starting $image..."
|
||||||
registry="$DEVC_REGISTRY"
|
[[ -n "${DEVC_REGISTRY:-}" ]] || die "registry unknown; set the DEVC_REGISTRY environment variable"
|
||||||
else
|
|
||||||
log "registry unknown; set the DEVC_REGISTRY environment variable" 'x' 31
|
default_args
|
||||||
exit 1
|
param_args "$@"
|
||||||
|
|
||||||
|
podman network create --ignore "devc" &>/dev/null
|
||||||
|
podman run --replace --stop-timeout 0 -td "${run_opts[@]}" "$DEVC_REGISTRY/$image"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Get container command from the DEVC_COMMAND env variable
|
exec podman exec --detach-keys "ctrl-@,ctrl-@" -it "$name" ${DEVC_COMMAND:-bash -l}
|
||||||
# if set, else use bash -l.
|
}
|
||||||
if [ -z "${DEVC_COMMAND:-}" ]; then
|
|
||||||
DEVC_COMMAND="bash -l"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# When container is not running or arguments are provided,
|
main "$@"
|
||||||
# recreate it.
|
|
||||||
if [ "$(podman container inspect "$name" -f {{.State.Running}} 2>&1)" != 'true' ] || [[ $# -gt 0 ]]; then
|
|
||||||
log "starting devcontainer..."
|
|
||||||
podman network create --ignore "dev-$name"
|
|
||||||
podman network create --ignore "devc"
|
|
||||||
podman container rm -f -t 0 "$name" 1>/dev/null
|
|
||||||
podman run -td $(default_args) $(param_args $@) "$registry/$image"
|
|
||||||
fi
|
|
||||||
|
|
||||||
podman exec --detach-keys "ctrl-@" -it "$name" ${DEVC_COMMAND:-}
|
|
||||||
|
|||||||
@@ -1,28 +0,0 @@
|
|||||||
# 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