use targets for arch toolbox build to keep things in one containerfile
All checks were successful
Reese's Arch Toolbox / build-and-push-arch-toolbox (push) Successful in 43m57s
All checks were successful
Reese's Arch Toolbox / build-and-push-arch-toolbox (push) Successful in 43m57s
This commit is contained in:
@@ -25,6 +25,7 @@ jobs:
|
||||
with:
|
||||
context: ${{ gitea.workspace }}/infrastructure/graduated/distoolbox
|
||||
file: ${{ gitea.workspace }}/infrastructure/graduated/distoolbox/arch-toolbox.containerfile
|
||||
target: cpu
|
||||
push: true
|
||||
tags: "gitea.reeseapps.com/services/arch-toolbox:latest,gitea.reeseapps.com/services/arch-toolbox:${{gitea.sha}}"
|
||||
no-cache: true
|
||||
@@ -32,7 +33,8 @@ jobs:
|
||||
uses: https://github.com/docker/build-push-action@v5
|
||||
with:
|
||||
context: ${{ gitea.workspace }}/infrastructure/graduated/distoolbox
|
||||
file: ${{ gitea.workspace }}/infrastructure/graduated/distoolbox/arch-amdgpu-toolbox.containerfile
|
||||
file: ${{ gitea.workspace }}/infrastructure/graduated/distoolbox/arch-toolbox.containerfile
|
||||
target: amdgpu
|
||||
push: true
|
||||
tags: "gitea.reeseapps.com/services/arch-toolbox-amdgpu:latest,gitea.reeseapps.com/services/arch-toolbox-amdgpu:${{gitea.sha}}"
|
||||
no-cache: true
|
||||
@@ -1,14 +0,0 @@
|
||||
FROM gitea.reeseapps.com/services/arch-toolbox:latest
|
||||
|
||||
# Install ROCM Drivers
|
||||
RUN pacman -S --noconfirm rocm-hip-sdk rocm-opencl-sdk
|
||||
|
||||
# Install Ollama, an AI language model application.
|
||||
RUN curl -L https://ollama.com/download/ollama-linux-amd64.tgz -o ollama-linux-amd64.tgz && \
|
||||
tar -C /usr -xzf ollama-linux-amd64.tgz && \
|
||||
rm ollama-linux-amd64.tgz
|
||||
|
||||
# Install Ollama AMD drivers
|
||||
RUN curl -L https://ollama.com/download/ollama-linux-amd64-rocm.tgz -o ollama-linux-amd64-rocm.tgz && \
|
||||
tar -C /usr -xzf ollama-linux-amd64-rocm.tgz && \
|
||||
rm ollama-linux-amd64-rocm.tgz
|
||||
@@ -8,16 +8,23 @@ COMMAND_PREFIX=""
|
||||
# docker context create podman --docker host=unix://$XDG_RUNTIME_DIR/podman/podman.sock
|
||||
# docker context use podman
|
||||
|
||||
export DEBUG_TAG="debug-$(date +"%s")"
|
||||
|
||||
docker image pull docker.io/archlinux:latest
|
||||
|
||||
# Run the build for the CPU image
|
||||
docker build \
|
||||
-t gitea.reeseapps.com/services/arch-toolbox:latest \
|
||||
-t gitea.reeseapps.com/services/arch-toolbox:$DEBUG_TAG \
|
||||
-f ./infrastructure/graduated/distoolbox/arch-toolbox.containerfile \
|
||||
--target cpu \
|
||||
--load \
|
||||
--no-cache \
|
||||
./infrastructure/graduated/distoolbox
|
||||
|
||||
# Run the build for the AMD gpu image
|
||||
docker build \
|
||||
-t gitea.reeseapps.com/services/arch-toolbox-amdgpu:latest \
|
||||
-f ./infrastructure/graduated/distoolbox/arch-amdgpu-toolbox.containerfile \
|
||||
-t gitea.reeseapps.com/services/arch-toolbox-amdgpu:$DEBUG_TAG \
|
||||
-f ./infrastructure/graduated/distoolbox/arch-toolbox.containerfile \
|
||||
--target amdgpu \
|
||||
--load \
|
||||
./infrastructure/graduated/distoolbox
|
||||
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
kill $(cat /tmp/ollama.pid)
|
||||
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
tail -f /tmp/ollama.log
|
||||
@@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
ollama serve &> /tmp/ollama.log &
|
||||
OLLAMA_PID=$!
|
||||
echo $OLLAMA_PID > /tmp/ollama.pid
|
||||
@@ -1,7 +1,11 @@
|
||||
# Dockerfile for an Arch Linux Toolbox environment with a variety of development and utility tools.
|
||||
|
||||
###########################
|
||||
##### CPU Image #####
|
||||
###########################
|
||||
|
||||
# Base image using the latest version from quay.io/toolbx/arch-toolbox.
|
||||
FROM docker.io/archlinux:latest
|
||||
FROM docker.io/archlinux:latest AS cpu
|
||||
|
||||
########################
|
||||
##### Pacman #####
|
||||
@@ -93,12 +97,14 @@ RUN pacman -S --noconfirm \
|
||||
libmemcached-awesome \
|
||||
# For distrobox
|
||||
systemd \
|
||||
# Code build \
|
||||
# Code build
|
||||
make gcc \
|
||||
# makepkg support
|
||||
base-devel \
|
||||
# Fonts, so you never have to think about them again
|
||||
noto-fonts noto-fonts-cjk noto-fonts-emoji noto-fonts-extra
|
||||
noto-fonts noto-fonts-cjk noto-fonts-emoji noto-fonts-extra \
|
||||
# Reattach to running processes
|
||||
reptyr
|
||||
|
||||
########################
|
||||
##### Extra Apps #####
|
||||
@@ -127,3 +133,29 @@ COPY arch-toolbox-supporting-files/arch-toolbox-tmux.conf /etc/tmux.conf
|
||||
|
||||
# Copy useradd to set default shell
|
||||
COPY arch-toolbox-supporting-files/arch-toolbox-default-useradd /etc/default/useradd
|
||||
|
||||
#####################
|
||||
##### AMD GPU #####
|
||||
#####################
|
||||
|
||||
FROM cpu AS amdgpu
|
||||
|
||||
# Install ROCM Drivers
|
||||
RUN pacman -S --noconfirm rocm-hip-sdk rocm-opencl-sdk
|
||||
|
||||
# Install Ollama, an AI language model application.
|
||||
RUN curl -L https://ollama.com/download/ollama-linux-amd64.tgz -o ollama-linux-amd64.tgz && \
|
||||
tar -C /usr -xzf ollama-linux-amd64.tgz && \
|
||||
rm ollama-linux-amd64.tgz
|
||||
|
||||
# Install Ollama AMD drivers
|
||||
RUN curl -L https://ollama.com/download/ollama-linux-amd64-rocm.tgz -o ollama-linux-amd64-rocm.tgz && \
|
||||
tar -C /usr -xzf ollama-linux-amd64-rocm.tgz && \
|
||||
rm ollama-linux-amd64-rocm.tgz
|
||||
|
||||
# Set up ollama-server and ollama-kill scripts
|
||||
RUN mkdir /usr/local/bin/tbox-ollama
|
||||
COPY arch-toolbox-supporting-files/ollama-serve /usr/local/bin/tbox-ollama/ollama-serve
|
||||
COPY arch-toolbox-supporting-files/ollama-serve /usr/local/bin/tbox-ollama/ollama-kill
|
||||
COPY arch-toolbox-supporting-files/ollama-serve /usr/local/bin/tbox-ollama/ollama-log
|
||||
RUN chmod -R +x /usr/local/bin/tbox-ollama
|
||||
@@ -4,26 +4,12 @@ Distrobox? Toolbox? Whatever you want.
|
||||
|
||||
- [Distoolbox](#distoolbox)
|
||||
- [Reese's Arch Distoolbox](#reeses-arch-distoolbox)
|
||||
- [Using Reese's Arch Toolbox](#using-reeses-arch-toolbox)
|
||||
- [CPU Image with Distrobox](#cpu-image-with-distrobox)
|
||||
- [AMD GPU Image with Distrobox](#amd-gpu-image-with-distrobox)
|
||||
- [CPU Image with Toolbox](#cpu-image-with-toolbox)
|
||||
- [AMD GPU Image with Toolbox](#amd-gpu-image-with-toolbox)
|
||||
- [Using Reese's Arch Toolbox](#using-reeses-arch-toolbox)
|
||||
- [Integrating distoolbox into your workflow](#integrating-distoolbox-into-your-workflow)
|
||||
- [Aliases using Distrobox](#aliases-using-distrobox)
|
||||
- [Aliases using Toolbox](#aliases-using-toolbox)
|
||||
- [Building Reese's Arch Toolbox](#building-reeses-arch-toolbox)
|
||||
|
||||
```bash
|
||||
# Create and use an Arch Toolbox
|
||||
toolbox create --distro arch
|
||||
toolbox enter arch-toolbox-latest
|
||||
```
|
||||
|
||||
I'd recommend adding this alias to your `.bashrc` to make things easier
|
||||
|
||||
```bash
|
||||
# Toolbox quick enter
|
||||
alias tbox='SHELL=zsh toolbox enter arch-toolbox-latest'
|
||||
```
|
||||
|
||||
## Reese's Arch Distoolbox
|
||||
|
||||
I have a custom arch image based on the default arch-toolbox image. It offers:
|
||||
@@ -52,7 +38,21 @@ I have a custom arch image based on the default arch-toolbox image. It offers:
|
||||
- code
|
||||
- make, gcc
|
||||
|
||||
## Using Reese's Arch Toolbox
|
||||
### Using Reese's Arch Toolbox
|
||||
|
||||
Head to <https://gitea.reeseapps.com/services/-/packages> and pick the CPU
|
||||
image or AMD GPU image.
|
||||
|
||||
If you can't decide pick the CPU image.
|
||||
|
||||
The GPU image was built and tested with a Framework 16 with 7700s GPU module.
|
||||
|
||||
Click the image and copy the tag (should be something like:
|
||||
2a421392b1bde168973a0c7ac8be05a6ffa1c48a)
|
||||
|
||||
Next you need [distrobox](https://distrobox.it/) or
|
||||
[toolbox](https://docs.fedoraproject.org/en-US/fedora-silverblue/toolbox/).
|
||||
Both are good options.
|
||||
|
||||
If you don't know whether to use distrobox or toolbox:
|
||||
|
||||
@@ -61,6 +61,25 @@ If you don't know whether to use distrobox or toolbox:
|
||||
- If you understand distrobox and you've never used toolbox, try toolbox
|
||||
- If you care what I use: distrobox
|
||||
|
||||
Once you have toolbox or distrobox installed, try the following:
|
||||
|
||||
```bash
|
||||
export TBOX_REPO='gitea.reeseapps.com/services'
|
||||
export TBOX_IMAGE='arch-toolbox'
|
||||
export TBOX_TAG=paste image tag copied above here
|
||||
export TBOX_NAME="$TBOX_IMAGE-$TBOX_TAG"
|
||||
|
||||
# With distrobox
|
||||
distrobox create --name $TBOX_NAME --image $TBOX_REPO/$TBOX_IMAGE:$TBOX_TAG
|
||||
distrobox enter $TBOX_NAME
|
||||
|
||||
# With toolbox
|
||||
toolbox create -i $TBOX_REPO/$TBOX_IMAGE:$TBOX_TAG
|
||||
SHELL=/bin/zsh toolbox enter $TBOX_NAME
|
||||
```
|
||||
|
||||
### Integrating distoolbox into your workflow
|
||||
|
||||
Copy the relevant aliases below into your `.bashrc`.
|
||||
|
||||
Run `ntbox` the first time to create a new toolbox.
|
||||
@@ -69,72 +88,42 @@ Run `tbox` anytime you want to enter the toolbox.
|
||||
|
||||
Run `rtbox` to delete the toolbox.
|
||||
|
||||
### CPU Image with Distrobox
|
||||
#### Aliases using Distrobox
|
||||
|
||||
Add the following to your `.bashrc`
|
||||
|
||||
```bash
|
||||
# Reese's Toolbox Commands
|
||||
export TBOX_REPO='gitea.reeseapps.com/services'
|
||||
export TBOX_IMAGE='arch-toolbox'
|
||||
export TBOX_TAG='latest'
|
||||
|
||||
# NOTE: Uncomment one of the below for either the amdgpu or cpu image
|
||||
# export TBOX_IMAGE='arch-toolbox'
|
||||
# export TBOX_IMAGE='arch-toolbox-amdgpu'
|
||||
|
||||
export TBOX_TAG=paste image tag copied above here
|
||||
export TBOX_NAME="$TBOX_IMAGE-$TBOX_TAG"
|
||||
|
||||
# Creates a new toolbox
|
||||
alias ntbox="distrobox create --name $TBOX_NAME --image $TBOX_REPO/$TBOX_IMAGE:$TBOX_TAG"
|
||||
# Enters the toolbox when you want to use it, you'll be running this all the time
|
||||
alias tbox="distrobox enter $TBOX_NAME"
|
||||
# Removes the toolbox
|
||||
alias rtbox="distrobox stop $TBOX_NAME --yes"
|
||||
alias rtbox="distrobox stop $TBOX_NAME --yes && podman container rm $TBOX_NAME"
|
||||
```
|
||||
|
||||
### AMD GPU Image with Distrobox
|
||||
|
||||
This was built and tested for a Framework 16 with GPU module.
|
||||
|
||||
Add the following to your `.bashrc`
|
||||
#### Aliases using Toolbox
|
||||
|
||||
```bash
|
||||
# Reese's Toolbox Commands
|
||||
export TBOX_REPO='gitea.reeseapps.com/services'
|
||||
export TBOX_IMAGE='arch-toolbox-amdgpu'
|
||||
|
||||
# NOTE: Uncomment one of the below for either the amdgpu or cpu image
|
||||
# export TBOX_IMAGE='arch-toolbox'
|
||||
# export TBOX_IMAGE='arch-toolbox-amdgpu'
|
||||
|
||||
export TBOX_TAG='latest'
|
||||
export TBOX_NAME="$TBOX_IMAGE-$TBOX_TAG"
|
||||
# Creates a new toolbox
|
||||
alias ntbox="distrobox create --name $TBOX_NAME --image $TBOX_REPO/$TBOX_IMAGE:$TBOX_TAG"
|
||||
# Enters the toolbox when you want to use it, you'll be running this all the time
|
||||
alias tbox="distrobox enter $TBOX_NAME -- /bin/zsh"
|
||||
# Removes the toolbox
|
||||
alias rtbox="distrobox stop $TBOX_NAME --yes"
|
||||
```
|
||||
|
||||
### CPU Image with Toolbox
|
||||
|
||||
```bash
|
||||
# Reese's Toolbox Commands
|
||||
export TBOX_REPO='gitea.reeseapps.com/services'
|
||||
export TBOX_IMAGE='arch-toolbox'
|
||||
export TBOX_TAG='latest'
|
||||
export TBOX_NAME="$TBOX_IMAGE-$TBOX_TAG"
|
||||
# Creates a new toolbox
|
||||
alias ntbox="toolbox create -i $TBOX_REPO/$TBOX_IMAGE:$TBOX_TAG"
|
||||
# Enters the toolbox when you want to use it, you'll be running this all the time
|
||||
alias tbox="SHELL=/bin/zsh toolbox enter $TBOX_NAME"
|
||||
# Removes the toolbox
|
||||
alias rtbox="podman container stop $TBOX_NAME && podman container rm $TBOX_NAME"
|
||||
```
|
||||
|
||||
### AMD GPU Image with Toolbox
|
||||
|
||||
This was built and tested for a Framework 16 with GPU module.
|
||||
|
||||
Add the following to your `.bashrc`
|
||||
|
||||
```bash
|
||||
# Reese's Toolbox Commands
|
||||
export TBOX_REPO='gitea.reeseapps.com/services'
|
||||
export TBOX_IMAGE='arch-toolbox-amdgpu'
|
||||
export TBOX_TAG='latest'
|
||||
export TBOX_NAME="$TBOX_IMAGE-$TBOX_TAG"
|
||||
# Creates a new toolbox
|
||||
alias ntbox="toolbox create -i $TBOX_REPO/$TBOX_IMAGE:$TBOX_TAG"
|
||||
# Enters the toolbox when you want to use it, you'll be running this all the time
|
||||
@@ -145,17 +134,10 @@ alias rtbox="podman container stop $TBOX_NAME && podman container rm $TBOX_NAME"
|
||||
|
||||
## Building Reese's Arch Toolbox
|
||||
|
||||
You can build and run the image wit this (See `Containerfile` in this directory):
|
||||
You can build and run the image with the `arch-build.sh` script (See `Containerfile` in this directory):
|
||||
|
||||
```bash
|
||||
# Build latest image
|
||||
podman build \
|
||||
--no-cache \
|
||||
-t gitea.reeseapps.com/services/arch-toolbox:latest \
|
||||
-f ./infrastructure/graduated/fedora/Containerfile
|
||||
|
||||
# Test with podman
|
||||
podman run -it --rm gitea.reeseapps.com/services/arch-toolbox:latest
|
||||
./infrastructure/graduated/distoolbox/arch-build.sh
|
||||
```
|
||||
|
||||
In vscode you can set this as your default build task for homelab and trigger it with
|
||||
@@ -172,7 +154,7 @@ In vscode you can set this as your default build task for homelab and trigger it
|
||||
{
|
||||
"label": "Build arch-toolbox",
|
||||
"type": "shell",
|
||||
"command": "./infrastructure/graduated/fedora/arch-build.sh",
|
||||
"command": "./infrastructure/graduated/distoolbox/arch-build.sh",
|
||||
"problemMatcher": [],
|
||||
"group": {
|
||||
"kind": "build",
|
||||
|
||||
Reference in New Issue
Block a user