From 9ef278fc7c554f249e524eaf01c74f48cb31e146 Mon Sep 17 00:00:00 2001 From: maurice Date: Tue, 28 Oct 2025 08:46:30 +0100 Subject: [PATCH] Move to Fedora --- .gitea/workflows/base.yaml | 14 +------------- .gitea/workflows/other.yaml | 8 ++++---- base.Containerfile | 37 +++++++++++++++++++++---------------- build.sh | 2 +- config/{.bashrc => bashrc} | 0 config/bin/host | 4 ++++ dotnet.Containerfile | 9 +++++++++ enter.sh | 3 ++- fullstack.Containerfile | 10 ---------- php.Containerfile | 3 +-- rust.Containerfile | 6 ++---- scripts/build-host-spawn.sh | 18 ------------------ web-base.Containerfile | 7 ------- 13 files changed, 45 insertions(+), 76 deletions(-) rename config/{.bashrc => bashrc} (100%) create mode 100644 config/bin/host create mode 100644 dotnet.Containerfile delete mode 100644 fullstack.Containerfile delete mode 100644 scripts/build-host-spawn.sh delete mode 100644 web-base.Containerfile diff --git a/.gitea/workflows/base.yaml b/.gitea/workflows/base.yaml index 8c9f301..441aa88 100644 --- a/.gitea/workflows/base.yaml +++ b/.gitea/workflows/base.yaml @@ -4,9 +4,7 @@ on: branches: ["main"] paths: - "base.Containerfile" - - "web-base.Containerfile" - "config/" - - "scripts/build-host-spawn.sh" - ".gitea/workflows/base.yaml" jobs: @@ -32,14 +30,4 @@ jobs: push: true tags: git.plabble.org/maurice/devc-base:${{ 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 Web Base container - uses: docker/build-push-action@v5 - with: - context: . - file: ./web-base.Containerfile - push: true - tags: git.plabble.org/maurice/devc-web-base:${{ github.ref_name }} - build-args: TAG=${{ github.ref_name }} - outputs: type=image,oci-mediatypes=true,compression=zstd,compression-level=3,force-compression=true + outputs: type=image,oci-mediatypes=true,compression=zstd,compression-level=3,force-compression=true \ No newline at end of file diff --git a/.gitea/workflows/other.yaml b/.gitea/workflows/other.yaml index 90e0574..f1ec6d4 100644 --- a/.gitea/workflows/other.yaml +++ b/.gitea/workflows/other.yaml @@ -3,7 +3,7 @@ on: push: branches: ["main"] paths: - - "fullstack.Containerfile" + - "dotnet.Containerfile" - "php.Containerfile" - "rust.Containerfile" - "scripts/install-roslyn.sh" @@ -44,12 +44,12 @@ jobs: build-args: TAG=${{ github.ref_name }} outputs: type=image,oci-mediatypes=true,compression=zstd,compression-level=3,force-compression=true - - name: Build and push Fullstack container + - name: Build and push Dotnet container uses: docker/build-push-action@v5 with: context: . - file: ./fullstack.Containerfile + file: ./dotnet.Containerfile push: true - tags: git.plabble.org/maurice/devc-fullstack:${{ github.ref_name }} + tags: git.plabble.org/maurice/devc-dotnet:${{ github.ref_name }} build-args: TAG=${{ github.ref_name }} outputs: type=image,oci-mediatypes=true,compression=zstd,compression-level=3,force-compression=true diff --git a/base.Containerfile b/base.Containerfile index 12e34f4..58d8417 100644 --- a/base.Containerfile +++ b/base.Containerfile @@ -1,24 +1,29 @@ -FROM alpine:latest +FROM fedora:43 -RUN apk update && apk add --no-cache \ - git openssh helix bash bash-completion go curl \ - helix-tree-sitter-vendor podman-compose wl-clipboard +# Install dependencies +RUN dnf update -y && \ + dnf -y install procps ping bash-completion glibc-langpack-en \ + host-spawn dbus-launch \ + git unzip helix pnpm -# tree-sitter-yaml, tree-sitter-caddy +# 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 -RUN adduser -D -u 1000 -s /bin/bash user +USER user +WORKDIR /home/user -# Compile host-spawn -COPY scripts/build-host-spawn.sh . -RUN chmod +x build-host-spawn.sh -RUN ./build-host-spawn.sh +# Setup some language servers from NPM +RUN pnpm setup && . /home/user/.bashrc && pnpm i -g deno bash-language-server vscode-langservers-extracted dockerfile-language-server-nodejs \ + typescript typescript-language-server + +# Copy configs +COPY --chown=user:user config/bashrc .bashrc +COPY --chown=user:user config/.config/ .config/ +COPY config/bin /usr/local/bin # Allow Podman host access -RUN ln -s /usr/local/bin/spawn /usr/local/bin/podman +RUN ln -s /usr/local/bin/host /usr/local/bin/podman -# Config files -COPY config/ /home/user/ -RUN chown -R user:user /home/user - -WORKDIR /home/user VOLUME /home/user \ No newline at end of file diff --git a/build.sh b/build.sh index 1fd6634..51fc458 100755 --- a/build.sh +++ b/build.sh @@ -15,4 +15,4 @@ if [ ! -f "$containerfile" ]; then exit 1 fi -podman build -t "devc-$1" -f $containerfile \ No newline at end of file +podman build -t "git.plabble.org/maurice/devc-$1:test" -f $containerfile \ No newline at end of file diff --git a/config/.bashrc b/config/bashrc similarity index 100% rename from config/.bashrc rename to config/bashrc diff --git a/config/bin/host b/config/bin/host new file mode 100644 index 0000000..71c121b --- /dev/null +++ b/config/bin/host @@ -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")") "$@" \ No newline at end of file diff --git a/dotnet.Containerfile b/dotnet.Containerfile new file mode 100644 index 0000000..c24c304 --- /dev/null +++ b/dotnet.Containerfile @@ -0,0 +1,9 @@ +FROM git.plabble.org/maurice/devc-base:main + +USER root +RUN dnf -y install dotnet-sdk-9.0 + +COPY scripts/install-roslyn.sh /tmp/install-roslyn.sh +RUN chmod +x /tmp/install-roslyn.sh && /tmp/install-roslyn.sh + +USER user \ No newline at end of file diff --git a/enter.sh b/enter.sh index c86de97..011ea40 100755 --- a/enter.sh +++ b/enter.sh @@ -7,6 +7,7 @@ if [ -z "$1" ]; then fi name="devc-$1" +tag="main" command="/bin/bash" # When container is not running or arguments are provided, @@ -29,7 +30,7 @@ if [ "$(podman container inspect "$name" -f {{.State.Running}} 2>&1)" != 'true' -v /run/user/$UID/wayland-0:/tmp/xdg/wayland-0 \ -v $HOME/dev:/home/user/dev \ -v v-$name:/home/user:copy \ - --rm -td git.plabble.org/maurice/$name:main + --rm -td git.plabble.org/maurice/$name:$tag fi podman exec --detach-keys "ctrl-@" -it "$name" ${command:-} diff --git a/fullstack.Containerfile b/fullstack.Containerfile deleted file mode 100644 index 4d7501f..0000000 --- a/fullstack.Containerfile +++ /dev/null @@ -1,10 +0,0 @@ -FROM git.plabble.org/maurice/devc-web-base:main - -RUN apk add --no-cache \ - dotnet9-sdk - -COPY scripts/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 \ No newline at end of file diff --git a/php.Containerfile b/php.Containerfile index f066316..8d2db8e 100644 --- a/php.Containerfile +++ b/php.Containerfile @@ -1,4 +1,3 @@ -FROM git.plabble.org/maurice/devc-web-base:main +FROM git.plabble.org/maurice/devc-base:main -USER user RUN /bin/bash -c "$(curl -fsSL https://php.new/install/linux/8.4)" \ No newline at end of file diff --git a/rust.Containerfile b/rust.Containerfile index 9bbe731..ce3336d 100644 --- a/rust.Containerfile +++ b/rust.Containerfile @@ -1,6 +1,4 @@ FROM git.plabble.org/maurice/devc-base:main -RUN su -c "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y" user -RUN su -c ". '/home/user/.cargo/env' && rustup component add rust-analyzer" user - -USER user \ No newline at end of file +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y +RUN . '/home/user/.cargo/env' && rustup component add rust-analyzer \ No newline at end of file diff --git a/scripts/build-host-spawn.sh b/scripts/build-host-spawn.sh deleted file mode 100644 index d71270d..0000000 --- a/scripts/build-host-spawn.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -mkdir /tmp/build -cd /tmp/build -git clone https://github.com/1player/host-spawn.git -cd host-spawn -chmod +x build.sh -./build.sh $(uname -m) -cd build -mv host-spawn* /usr/local/bin/host-spawn -rm -rf /tmp/build - -cat << EOF > /usr/local/bin/spawn -#!/bin/bash -export DBUS_SESSION_BUS_ADDRESS='unix:path=/tmp/dbus.sock' -host-spawn -cwd "\${PWD/#\$HOME/\$HOST_HOME}" \ - $([ "$(basename "\$0")" != "spawn" ] && echo "\$(basename "\$0")") "\$@" -EOF -chmod +x /usr/local/bin/spawn \ No newline at end of file diff --git a/web-base.Containerfile b/web-base.Containerfile deleted file mode 100644 index 2865296..0000000 --- a/web-base.Containerfile +++ /dev/null @@ -1,7 +0,0 @@ -FROM git.plabble.org/maurice/devc-base:main - -RUN apk add --no-cache \ - deno pnpm - -RUN su -c "pnpm setup && . /home/user/.bashrc && pnpm i -g bash-language-server vscode-langservers-extracted dockerfile-language-server-nodejs \ - typescript typescript-language-server" user \ No newline at end of file -- 2.49.1