Compare commits
4
Commits
b3cf017f28
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
80f57d9a91 | ||
|
|
622e3de7f7 | ||
|
|
ddaaa4601e | ||
|
|
ef1eef1674 |
@@ -1,34 +1,18 @@
|
|||||||
name: Build containers
|
name: Build container
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
push:
|
push:
|
||||||
branches: ["main"]
|
branches: ["main"]
|
||||||
paths: ["containers/**", ".gitea/workflows/build.yaml"]
|
paths: ["container/**", ".gitea/workflows/build.yaml"]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: ["main"]
|
branches: ["main"]
|
||||||
paths: ["containers/**", ".gitea/workflows/build.yaml"]
|
paths: ["container/**", ".gitea/workflows/build.yaml"]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
changes:
|
build:
|
||||||
runs-on: job-v2
|
|
||||||
outputs:
|
|
||||||
any_change: ${{ steps.filter.outputs.workflow == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'}}
|
|
||||||
base: ${{ steps.filter.outputs.base == 'true' }}
|
|
||||||
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/**']
|
|
||||||
|
|
||||||
base-image:
|
|
||||||
needs: [changes]
|
|
||||||
if: ${{ needs.changes.outputs.base == 'true' || needs.changes.outputs.any_change == 'true' }}
|
|
||||||
runs-on: job-v2
|
runs-on: job-v2
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6
|
||||||
- name: Log in
|
- name: Log in
|
||||||
uses: redhat-actions/podman-login@v1
|
uses: redhat-actions/podman-login@v1
|
||||||
with:
|
with:
|
||||||
@@ -39,10 +23,11 @@ jobs:
|
|||||||
id: build
|
id: build
|
||||||
uses: job79/buildah-build@65b3793a1370c1ccd74a5c0d090d70eb9637a4ef
|
uses: job79/buildah-build@65b3793a1370c1ccd74a5c0d090d70eb9637a4ef
|
||||||
with:
|
with:
|
||||||
image: maurice/base
|
image: maurice/devc
|
||||||
tags: ${{ github.ref_name }}
|
tags: ${{ github.ref_name }}
|
||||||
context: ./containers/base
|
context: ./container
|
||||||
containerfiles: ./containers/base/Containerfile
|
containerfiles: ./container/Containerfile
|
||||||
|
platforms: linux/amd64
|
||||||
- name: Push
|
- name: Push
|
||||||
uses: redhat-actions/push-to-registry@v2
|
uses: redhat-actions/push-to-registry@v2
|
||||||
with:
|
with:
|
||||||
@@ -54,52 +39,3 @@ jobs:
|
|||||||
extra-args: |
|
extra-args: |
|
||||||
--compression-format=zstd
|
--compression-format=zstd
|
||||||
--compression-level=12
|
--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: [rust, dotnet, go]
|
|
||||||
# steps:
|
|
||||||
# - name: Check if build needed
|
|
||||||
# id: check
|
|
||||||
# run: |
|
|
||||||
# if [[ "${{ matrix.container }}" == "go" && "${{ needs.changes.outputs.go }}" == "true" ]]; then echo "run=true" >> $GITHUB_OUTPUT; fi
|
|
||||||
# if [[ "${{ matrix.container }}" == "rust" && "${{ needs.changes.outputs.rust }}" == "true" ]]; then echo "run=true" >> $GITHUB_OUTPUT; fi
|
|
||||||
# if [[ "${{ matrix.container }}" == "dotnet" && "${{ needs.changes.outputs.dotnet }}" == "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: maurice/${{ matrix.container }}
|
|
||||||
# tags: ${{ github.ref_name }}
|
|
||||||
# context: ./containers/${{ matrix.container }}
|
|
||||||
# containerfiles: ./containers/${{ matrix.container }}/Containerfile
|
|
||||||
# build-args: TAG=${{ github.ref_name }}
|
|
||||||
# - 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
|
|
||||||
|
|||||||
@@ -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
|
|
||||||
+69
-24
@@ -4,31 +4,51 @@ FROM quay.io/fedora/fedora:44
|
|||||||
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 --setopt=install_weak_deps=False install \
|
dnf -y --setopt=keepcache=1 --setopt=install_weak_deps=False install \
|
||||||
bash-completion git-core curl awk jq rg zip unzip which \
|
bash-completion \
|
||||||
host-spawn wl-copy gcc helix helix-themes rsync python3 python3-pip dotnet-sdk-10.0 openssl-devel
|
git-core \
|
||||||
|
curl \
|
||||||
|
awk \
|
||||||
|
jq \
|
||||||
|
rg \
|
||||||
|
zip \
|
||||||
|
unzip \
|
||||||
|
which \
|
||||||
|
ncurses \
|
||||||
|
sudo \
|
||||||
|
host-spawn \
|
||||||
|
wl-copy \
|
||||||
|
gcc \
|
||||||
|
helix \
|
||||||
|
helix-themes \
|
||||||
|
rsync \
|
||||||
|
python3 \
|
||||||
|
python3-pip \
|
||||||
|
dotnet-sdk-10.0 \
|
||||||
|
openssl-devel
|
||||||
|
|
||||||
# === setup user ===
|
# === setup user ===
|
||||||
RUN useradd -ms /bin/bash user && \
|
RUN useradd -ms /bin/bash user && \
|
||||||
echo 'user ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/user && \
|
echo 'user ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/user && \
|
||||||
|
chmod 0440 /etc/sudoers.d/user && \
|
||||||
mkdir -p /run/user/1000 && \
|
mkdir -p /run/user/1000 && \
|
||||||
chown user:user /run/user/1000
|
chown user:user /run/user/1000
|
||||||
|
|
||||||
# === Add host entry for podman & XDG open ===
|
|
||||||
RUN ln -s /usr/local/bin/host /usr/local/bin/podman && \
|
|
||||||
ln -s /usr/local/bin/host /usr/local/bin/xdg-open
|
|
||||||
|
|
||||||
COPY config/bin /usr/local/bin
|
COPY config/bin /usr/local/bin
|
||||||
|
|
||||||
|
# === Add host entry for podman & XDG open ===
|
||||||
|
RUN ln -sf /usr/local/bin/host /usr/local/bin/podman && \
|
||||||
|
ln -sf /usr/local/bin/host /usr/local/bin/xdg-open
|
||||||
|
|
||||||
# === languages & SDKs ===
|
# === languages & SDKs ===
|
||||||
|
|
||||||
# Golang
|
# Golang
|
||||||
|
ENV PATH="/usr/local/go/bin:/home/user/go/bin:${PATH}"
|
||||||
|
|
||||||
RUN GO_VERSION=$(curl -sL "https://go.dev/VERSION?m=text" | head -n 1 | tr -d '\r\n') && \
|
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 && \
|
curl -fsSL "https://go.dev/dl/${GO_VERSION}.linux-amd64.tar.gz" \
|
||||||
ln -sf /usr/local/go/bin/go /usr/local/bin/go && \
|
| tar xz -C /usr/local && \
|
||||||
ln -sf /usr/local/go/bin/gofmt /usr/local/bin/gofmt && \
|
GOBIN=/usr/local/bin go install golang.org/x/tools/gopls@latest && \
|
||||||
export GOPATH=/usr/local/go && \
|
GOBIN=/usr/local/bin go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest
|
||||||
go install golang.org/x/tools/gopls@latest && \
|
|
||||||
ln -sf /usr/local/go/bin/gopls /usr/local/bin/gopls
|
|
||||||
|
|
||||||
# Deno
|
# Deno
|
||||||
RUN export DENO_INSTALL=/usr/local/deno && \
|
RUN export DENO_INSTALL=/usr/local/deno && \
|
||||||
@@ -38,20 +58,22 @@ RUN export DENO_INSTALL=/usr/local/deno && \
|
|||||||
# Rust
|
# Rust
|
||||||
RUN export RUSTUP_HOME=/usr/local/rust && \
|
RUN export RUSTUP_HOME=/usr/local/rust && \
|
||||||
export CARGO_HOME=/usr/local/rust && \
|
export CARGO_HOME=/usr/local/rust && \
|
||||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --no-modify-path && \
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \
|
||||||
|
| sh -s -- -y --no-modify-path && \
|
||||||
ln -sf /usr/local/rust/bin/rustc /usr/local/bin/rustc && \
|
ln -sf /usr/local/rust/bin/rustc /usr/local/bin/rustc && \
|
||||||
ln -sf /usr/local/rust/bin/cargo /usr/local/bin/cargo && \
|
ln -sf /usr/local/rust/bin/cargo /usr/local/bin/cargo && \
|
||||||
ln -sf /usr/local/rust/bin/rustup /usr/local/bin/rustup && \
|
ln -sf /usr/local/rust/bin/rustup /usr/local/bin/rustup && \
|
||||||
ln -sf /usr/local/rust/bin/rustfmt /usr/local/bin/rustfmt && \
|
ln -sf /usr/local/rust/bin/rustfmt /usr/local/bin/rustfmt && \
|
||||||
ln -sf /usr/local/rust/bin/clippy /usr/local/bin/clippy && \
|
|
||||||
ln -sf /usr/local/rust/bin/rust-analyzer /usr/local/bin/rust-analyzer && \
|
ln -sf /usr/local/rust/bin/rust-analyzer /usr/local/bin/rust-analyzer && \
|
||||||
rustup component add rustfmt clippy rust-analyzer && \
|
rustup component add rustfmt clippy rust-analyzer rust-src && \
|
||||||
|
rustup target add wasm32-unknown-unknown && \
|
||||||
curl https://drager.github.io/wasm-pack/installer/init.sh -sSf | sh
|
curl https://drager.github.io/wasm-pack/installer/init.sh -sSf | sh
|
||||||
# cargo install cargo-generate && \
|
|
||||||
|
# cargo install cargo-generate
|
||||||
# cargo install cargo-expand
|
# cargo install cargo-expand
|
||||||
|
|
||||||
# Dotnet
|
# Dotnet
|
||||||
RUN dotnet tool install --global dotnet-ef && \
|
RUN dotnet tool install --tool-path /usr/local/bin dotnet-ef && \
|
||||||
mkdir -p /usr/local/bin/omnisharp && \
|
mkdir -p /usr/local/bin/omnisharp && \
|
||||||
curl -L https://github.com/OmniSharp/omnisharp-roslyn/releases/latest/download/omnisharp-linux-x64-net6.0.tar.gz \
|
curl -L https://github.com/OmniSharp/omnisharp-roslyn/releases/latest/download/omnisharp-linux-x64-net6.0.tar.gz \
|
||||||
| tar xz -C /usr/local/bin/omnisharp && \
|
| tar xz -C /usr/local/bin/omnisharp && \
|
||||||
@@ -82,16 +104,36 @@ RUN --mount=type=cache,id=dnf-cache,target=/var/cache/libdnf5 \
|
|||||||
php-zts-mysqli \
|
php-zts-mysqli \
|
||||||
php-zts-imagick \
|
php-zts-imagick \
|
||||||
php-zts-grpc && \
|
php-zts-grpc && \
|
||||||
curl -fsSL https://getcomposer.org/installer | \
|
curl -fsSL https://getcomposer.org/installer \
|
||||||
php -- --install-dir=/usr/local/bin --filename=composer
|
| php -- --install-dir=/usr/local/bin --filename=composer
|
||||||
|
|
||||||
# === install language servers, tools ===
|
# === install language servers, tools ===
|
||||||
RUN deno i -g -f -A --root /usr/local/bin npm:npm npm:bash-language-server npm:vscode-langservers-extracted npm:dockerfile-language-server-nodejs \
|
RUN deno i -g -f -A --root /usr/local/bin \
|
||||||
npm:typescript npm:typescript-language-server
|
npm:npm \
|
||||||
|
npm:bash-language-server \
|
||||||
|
npm:vscode-langservers-extracted \
|
||||||
|
npm:dockerfile-language-server-nodejs \
|
||||||
|
npm:typescript \
|
||||||
|
npm:typescript-language-server
|
||||||
|
|
||||||
|
RUN mkdir -p /usr/local/bin/python-bins/code-review-graph && \
|
||||||
|
pip install code-review-graph \
|
||||||
|
--target /usr/local/bin/python-bins/code-review-graph && \
|
||||||
|
ln -sf \
|
||||||
|
/usr/local/bin/python-bins/code-review-graph/bin/code-review-graph \
|
||||||
|
/usr/local/bin/code-review-graph
|
||||||
|
|
||||||
|
# Rustup is intended to remain writable by the development user.
|
||||||
|
RUN chown -R user:user /usr/local/rust
|
||||||
|
|
||||||
USER user
|
USER user
|
||||||
WORKDIR /home/user
|
WORKDIR /home/user
|
||||||
RUN mkdir -p .config .local .cache
|
|
||||||
|
RUN mkdir -p \
|
||||||
|
.config \
|
||||||
|
.local \
|
||||||
|
.cache \
|
||||||
|
go/bin
|
||||||
|
|
||||||
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
|
||||||
@@ -99,8 +141,11 @@ COPY --chown=user:user config/helix/ .config/helix/
|
|||||||
|
|
||||||
# === Cleanup build dependencies ===
|
# === Cleanup build dependencies ===
|
||||||
USER root
|
USER root
|
||||||
RUN dnf remove -y openssl-devel && dnf clean all && \
|
|
||||||
rm -rf /tmp/* && rm -rf /root/*
|
RUN dnf remove -y openssl-devel && \
|
||||||
|
dnf clean all && \
|
||||||
|
rm -rf /tmp/* /root/* && \
|
||||||
|
pip cache purge
|
||||||
|
|
||||||
USER user
|
USER user
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ default_args() {
|
|||||||
"--userns=keep-id" # Map host user.
|
"--userns=keep-id" # Map host user.
|
||||||
"-v" "$name:/home/user:copy" # Persistent home volume.
|
"-v" "$name:/home/user:copy" # Persistent home volume.
|
||||||
"-v" "dnf-cache:/var/cache/libdnf5" # Cache dnf metadata.
|
"-v" "dnf-cache:/var/cache/libdnf5" # Cache dnf metadata.
|
||||||
|
"-v" "$HOME/dev:/home/user/dev" # dev folder
|
||||||
)
|
)
|
||||||
|
|
||||||
# Unix sockets require SELinux label disable.
|
# Unix sockets require SELinux label disable.
|
||||||
@@ -38,6 +39,7 @@ param_args() {
|
|||||||
-gpu) run_opts+=("--device" "/dev/dri") ;;
|
-gpu) run_opts+=("--device" "/dev/dri") ;;
|
||||||
-kvm) run_opts+=("--device" "/dev/kvm") ;;
|
-kvm) run_opts+=("--device" "/dev/kvm") ;;
|
||||||
-usb) run_opts+=("--device" "/dev/bus/usb") ;;
|
-usb) run_opts+=("--device" "/dev/bus/usb") ;;
|
||||||
|
-audio) run_opts+=("--device" "/dev/snd") ;;
|
||||||
-host-spawn) run_opts+=("-v" "/run/user/$UID/bus:/tmp/bus" "-e" "HOST_HOME=$HOME") ;;
|
-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") ;;
|
-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") ;;
|
-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") ;;
|
||||||
@@ -50,19 +52,8 @@ param_args() {
|
|||||||
|
|
||||||
main() {
|
main() {
|
||||||
local state_file="$HOME/.local/share/devc-previous-container"
|
local state_file="$HOME/.local/share/devc-previous-container"
|
||||||
local image="devc"
|
local image="devc:main"
|
||||||
|
local name="devc"
|
||||||
# Resolve container name (CLI arg > Last used > Error).
|
|
||||||
if [[ $image && $image != -* ]]; then
|
|
||||||
shift
|
|
||||||
[[ $image != *:* ]] && image+=":main"
|
|
||||||
echo "$image" >"$state_file"
|
|
||||||
elif [[ -f $state_file ]]; then
|
|
||||||
image=$(<$state_file)
|
|
||||||
else
|
|
||||||
die "no container name specified"
|
|
||||||
fi
|
|
||||||
local name="${image%:*}"
|
|
||||||
|
|
||||||
# Start/Restart if not running or if arguments change configuration.
|
# Start/Restart if not running or if arguments change configuration.
|
||||||
if [[ -z "$(podman ps -q -f name="^$name$" -f status=running)" ]] || (($# > 0)); then
|
if [[ -z "$(podman ps -q -f name="^$name$" -f status=running)" ]] || (($# > 0)); then
|
||||||
|
|||||||
Reference in New Issue
Block a user