fixes to imagen

This commit is contained in:
Madison Grubb
2026-03-13 11:17:38 -04:00
parent 2456195fbc
commit 7df63f21aa
7 changed files with 38 additions and 103 deletions
-9
View File
@@ -1,9 +0,0 @@
* text=auto eol=lf
# scripts
*.sh text eol=lf
*.bat text eol=crlf
## DOCKER
*.dockerignore text
Dockerfile text
+15 -27
View File
@@ -42,45 +42,33 @@ jobs:
uses: https://git.keligrubb.com/actions/docker-login-action@v4 uses: https://git.keligrubb.com/actions/docker-login-action@v4
with: with:
registry: ${{ env.REGISTRY }} registry: ${{ env.REGISTRY }}
username: jasper-agent username: actions-runner
password: ${{ secrets.JASPER_REPO_TOKEN }} password: ${{ secrets.ACTIONS_REPO_TOKEN }}
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: https://git.keligrubb.com/actions/docker-setup-buildx-action@v4 uses: https://git.keligrubb.com/actions/docker-setup-buildx-action@v4
- name: Compute tags and metadata - name: Compute tags and metadata
run: | run: |
if [[ "${{ github.event_name }}" == "schedule" || "${{ github.event_name }}" == "workflow_dispatch" ]]; then PART_TAG=$(date +%Y%m%d)
PART_TAG=$(date +%Y%m%d)
else
PART_TAG=dev
fi
echo "PART_TAG=$PART_TAG" >> "$GITHUB_ENV"
if [ "${LATEST_TAG}" = "${{ matrix.TAG }}" ]; then
RELEASE_TAG=$(lsb_release -rs)
else
RELEASE_TAG="${{ matrix.TAG }}"
fi
echo "RELEASE_TAG=$RELEASE_TAG" >> "$GITHUB_ENV"
BUILD_DATE=$(date -u +"%Y-%m-%d %H:%M:%SZ")
echo "BUILD_DATE=$BUILD_DATE" >> "$GITHUB_ENV"
TAG_NAME="act-${{ matrix.TAG }}" TAG_NAME="act-${{ matrix.TAG }}"
RELEASE_TAG="${{ matrix.TAG }}"
BUILD_DATE=$(date -u +"%Y-%m-%d %H:%M:%SZ")
{
echo "PART_TAG=$PART_TAG"
echo "RELEASE_TAG=$RELEASE_TAG"
echo "BUILD_DATE=$BUILD_DATE"
echo "ACT_TEST_IMAGE=${{ env.REGISTRY }}/${{ env.SLUG }}:${TAG_NAME}-${PART_TAG}"
} >>"$GITHUB_ENV"
{ {
echo "${TAG_NAME}-${PART_TAG}" echo "${TAG_NAME}-${PART_TAG}"
if [ "${LATEST_TAG}" = "${{ matrix.TAG }}" ]; then [ "${LATEST_TAG}" = "${{ matrix.TAG }}" ] && echo "act-latest-${PART_TAG}"
echo "act-latest-${PART_TAG}"
fi
echo "${TAG_NAME}" echo "${TAG_NAME}"
if [ "${LATEST_TAG}" = "${{ matrix.TAG }}" ]; then [ "${LATEST_TAG}" = "${{ matrix.TAG }}" ] && echo "act-latest"
echo "act-latest"
fi
} > .tags } > .tags
echo "ACT_TEST_IMAGE=${{ env.REGISTRY }}/${{ env.SLUG }}:${TAG_NAME}-${PART_TAG}" >> "$GITHUB_ENV"
- name: Build Docker image - name: Build Docker image
uses: https://git.keligrubb.com/actions/docker-build-push-action@v7 uses: https://git.keligrubb.com/actions/docker-build-push-action@v7
with: with:
-2
View File
@@ -9,14 +9,12 @@ ARG TARGETARCH
ARG FROM_IMAGE ARG FROM_IMAGE
ARG FROM_TAG ARG FROM_TAG
# > Our custom ARGs
# latest Node.js LTS versions # latest Node.js LTS versions
ARG NODE_VERSION="20 24" ARG NODE_VERSION="20 24"
ARG DISTRO=ubuntu ARG DISTRO=ubuntu
ARG TYPE=act ARG TYPE=act
ARG RUNNER ARG RUNNER
# > Force apt to not be interactive/not ask
ENV DEBIAN_FRONTEND=noninteractive ENV DEBIAN_FRONTEND=noninteractive
SHELL [ "/bin/bash", "--login", "-e", "-o", "pipefail", "-c" ] SHELL [ "/bin/bash", "--login", "-e", "-o", "pipefail", "-c" ]
+2 -11
View File
@@ -9,12 +9,7 @@ Built from [`scripts/act.sh`](./scripts/act.sh). Published to this repos Gite
- **Registry:** `git.keligrubb.com` - **Registry:** `git.keligrubb.com`
- **Image:** `git.keligrubb.com/actions/ubuntu` - **Image:** `git.keligrubb.com/actions/ubuntu`
- **Tags:** `act-22.04`, `act-24.04`, `act-latest` (and dated tags e.g. `act-24.04-YYYYMMDD`) - **Tags:** `act-22.04`, `act-24.04`, `act-latest` (and dated tags e.g. `act-24.04-YYYYMMDD`)
- **Base image:** `buildpack-deps` ([overview](https://hub.docker.com/_/buildpack-deps), [tags](https://hub.docker.com/_/buildpack-deps/tags), [source](https://github.com/docker-library/buildpack-deps))
## When images are updated
- Dependencies required for actions change
- Changes to GitHub Actions, Act, or the container registry
- Size or performance improvements
## Build locally ## Build locally
@@ -76,11 +71,7 @@ act -P ubuntu-latest=git.keligrubb.com/actions/ubuntu:act-24.04
Or put the image in `.actrc` or your workflows `runs-on` image. Or put the image in `.actrc` or your workflows `runs-on` image.
## Customising ## License
Edit [`scripts/act.sh`](./scripts/act.sh) to add or remove packages. Keep `DISTRO=ubuntu`, `TYPE=act`, and a valid `RUNNER` user, then re-run the build steps above.
## Licence
Parts of this repository are from [actions/virtual-environments][actions/virtual-environments], used under the [MIT License](https://github.com/actions/virtual-environments/blob/main/LICENSE). Parts of this repository are from [actions/virtual-environments][actions/virtual-environments], used under the [MIT License](https://github.com/actions/virtual-environments/blob/main/LICENSE).
+6 -19
View File
@@ -146,25 +146,12 @@ if [ -z "$from_image" ] || [ -z "$from_tag" ]; then
exit 1 exit 1
fi fi
if [ "$push" = true ]; then all_tags=$tags
# Combine tags and tag (if provided) if [ -n "$tag" ]; then
all_tags=$tags if [ -z "$all_tags" ]; then
if [ -n "$tag" ]; then all_tags=$tag
if [ -z "$all_tags" ]; then else
all_tags=$tag all_tags="$all_tags $tag"
else
all_tags="$all_tags $tag"
fi
fi
else
# Even when not pushing, honor --tag so the local image is named.
all_tags=$tags
if [ -n "$tag" ]; then
if [ -z "$all_tags" ]; then
all_tags=$tag
else
all_tags="$all_tags $tag"
fi
fi fi
fi fi
+3 -19
View File
@@ -145,28 +145,12 @@ for ver in "${NODE[@]}"; do
done done
case "$(uname -m)" in case "$(uname -m)" in
'aarch64') aarch64|x86_64|armv7l) ;;
scripts=(
yq
)
;;
'x86_64')
scripts=(
yq
)
;;
'armv7l')
scripts=(
yq
)
;;
*) exit 1 ;; *) exit 1 ;;
esac esac
for SCRIPT in "${scripts[@]}"; do printf "\n\t🧨 Executing yq.sh 🧨\t\n"
printf "\n\t🧨 Executing %s.sh 🧨\t\n" "${SCRIPT}" bash "/imagegeneration/installers/yq.sh"
bash "/imagegeneration/installers/${SCRIPT}.sh"
done
printf "\n\t🐋 Cleaning image 🐋\t\n" printf "\n\t🐋 Cleaning image 🐋\t\n"
apt-get clean apt-get clean
+12 -16
View File
@@ -27,20 +27,16 @@ download_with_retries() {
get_hash_from_remote_file() { get_hash_from_remote_file() {
local url=$1 local url=$1
local keywords=("$2" "$3") local keyword=$2
local delimiter=${4:-' '} local delimiter=${3:-' '}
local word_number=${5:-1} local word_number=${4:-1}
local matching_line local line
matching_line=$(curl -fsSL "$url" | sed 's/ */ /g' | tr -d '`') line=$(curl -fsSL "$url" | sed 's/ */ /g' | tr -d '`' | grep "$keyword" | head -n1 || true)
for keyword in "${keywords[@]}"; do if [ -z "$line" ]; then
matching_line=$(echo "$matching_line" | grep "$keyword" || true) echo "Keyword ($keyword) not found in the file with hashes." >&2
done
matching_line=$(echo "$matching_line" | head -n1)
if [ -z "$matching_line" ]; then
echo "Keywords (${keywords[*]}) not found in the file with hashes." >&2
exit 1 exit 1
fi fi
echo "$matching_line" | cut -d "$delimiter" -f "$word_number" | tr -d -c '[:alnum:]' echo "$line" | cut -d "$delimiter" -f "$word_number" | tr -d -c '[:alnum:]'
} }
use_checksum_comparison() { use_checksum_comparison() {
@@ -63,9 +59,9 @@ use_checksum_comparison() {
yq_arch() { yq_arch() {
case "$(uname -m)" in case "$(uname -m)" in
'aarch64') echo 'arm64' ;; aarch64) echo arm64 ;;
'x86_64') echo 'amd64' ;; x86_64) echo amd64 ;;
'armv7l') echo 'arm' ;; armv7l) echo arm ;;
*) exit 1 ;; *) exit 1 ;;
esac esac
} }
@@ -73,6 +69,6 @@ yq_arch() {
base_url="https://github.com/mikefarah/yq/releases/latest/download" base_url="https://github.com/mikefarah/yq/releases/latest/download"
filename="yq_linux_$(yq_arch)" filename="yq_linux_$(yq_arch)"
download_with_retries "${base_url}/${filename}" "/tmp" "yq" download_with_retries "${base_url}/${filename}" "/tmp" "yq"
external_hash=$(get_hash_from_remote_file "${base_url}/checksums" "${filename} " "" " " "19") external_hash=$(get_hash_from_remote_file "${base_url}/checksums" "${filename} " " " "19")
use_checksum_comparison "/tmp/yq" "${external_hash}" use_checksum_comparison "/tmp/yq" "${external_hash}"
sudo install /tmp/yq /usr/bin/yq sudo install /tmp/yq /usr/bin/yq