prop/.forgejo/workflows/build-ci-image.yaml
Graham McIntire 08175fc6ae
Some checks failed
Build CI test image / Build and push CI image (push) Failing after 3m9s
Build and Push / Build and Push Docker Image (push) Has been cancelled
feat: precompile EXLA in CI base image to prevent OOM kills
Add Dockerfile.ci that extends the hexpm/elixir image with precompiled
EXLA NIF cached at ~/.cache/xla/. When mix test runs, EXLA's cached_make
finds the precompiled libexla.so and skips the OOM-prone g++ C++
compilation entirely.

- Dockerfile.ci: two-stage build — builder compiles EXLA into cache;
  final stage copies the cache and installs test deps (cdo)
- .forgejo/workflows/build-ci-image.yaml: builds and pushes prop-ci
  image on mix.exs/mix.lock/vendor changes + weekly cron
- .forgejo/workflows/build.yaml: test step uses prop-ci:latest instead
  of raw hexpm/elixir image, removing apt-get + hex/rebar install steps
2026-08-05 09:13:50 -05:00

81 lines
2.3 KiB
YAML

name: Build CI test image
on:
push:
branches:
- main
paths:
- 'mix.exs'
- 'mix.lock'
- 'vendor/**'
- 'Dockerfile.ci'
- '.forgejo/workflows/build-ci-image.yaml'
schedule:
- cron: '0 8 * * 1'
workflow_dispatch:
env:
REGISTRY: git.mcintire.me
OWNER: graham
IMAGE_NAME: prop-ci
DOCKER_CLI_VERSION: '28.5.2'
BUILDX_VERSION: '0.35.0'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
jobs:
build-and-push:
name: Build and push CI image
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Docker CLI and buildx
run: |
set -euo pipefail
curl -fsSL --retry 3 --retry-delay 2 \
"https://download.docker.com/linux/static/stable/x86_64/docker-${DOCKER_CLI_VERSION}.tgz" \
| tar xz --strip-components=1 -C /usr/local/bin docker/docker
mkdir -p "$HOME/.docker/cli-plugins"
curl -fsSL --retry 3 --retry-delay 2 \
-o "$HOME/.docker/cli-plugins/docker-buildx" \
"https://github.com/docker/buildx/releases/download/v${BUILDX_VERSION}/buildx-v${BUILDX_VERSION}.linux-amd64"
chmod +x "$HOME/.docker/cli-plugins/docker-buildx"
docker version
docker buildx version
- name: Build and push
env:
REGISTRY_TOKEN: ${{ secrets.FORGEJO_TOKEN }}
run: |
set -euo pipefail
IMAGE="${REGISTRY}/${OWNER}/${IMAGE_NAME}"
SHA_TAG="${GITHUB_SHA::7}"
echo "$REGISTRY_TOKEN" | docker login "$REGISTRY" -u "$OWNER" --password-stdin
DOCKER_BUILDKIT=1 docker build \
--file Dockerfile.ci \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--cache-from "${IMAGE}:latest" \
--tag "${IMAGE}:${SHA_TAG}" \
--tag "${IMAGE}:latest" \
.
docker push "${IMAGE}:${SHA_TAG}"
docker push "${IMAGE}:latest"
{
echo "### CI image pushed"
echo ""
echo "- \`${IMAGE}:${SHA_TAG}\`"
echo "- \`${IMAGE}:latest\`"
} >> "$GITHUB_STEP_SUMMARY"
docker image rm "${IMAGE}:${SHA_TAG}" "${IMAGE}:latest" 2>/dev/null || true
docker logout "$REGISTRY" || true