diff --git a/.github/workflows/amd64-debian.yml b/.github/workflows/amd64-debian.yml new file mode 100644 index 0000000000..e3cdf5573a --- /dev/null +++ b/.github/workflows/amd64-debian.yml @@ -0,0 +1,43 @@ +name: AMD64 Debian + +on: + # run every day of the week at 02:00 + schedule: + - cron: 0 2 * * * + workflow_dispatch: + +jobs: + build-amd64-debian-docker: + name: Build for AMD64 on Docker (Debian slim) + runs-on: ubuntu-24.04 + steps: + - name: Check Docker and Docker Compose versions + run: | + docker --version + docker compose version + + - uses: actions/checkout@v2 + + - name: AMD64 Debian build + run: | + docker build -f Dockerfile.debian -t htm-amd64-debian-docker --build-arg arch=amd64 . + + - name: Tests + run: | + docker run htm-amd64-debian-docker python htm_test.py + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Tag and push Docker image + run: | + docker tag htm-amd64-debian-docker ghcr.io/${{ github.repository }}/htm-amd64-debian:latest + docker tag htm-amd64-debian-docker ghcr.io/${{ github.repository }}/htm-amd64-debian:${{ github.run_number }} + docker tag htm-amd64-debian-docker ghcr.io/${{ github.repository }}/htm-amd64-debian:${{ github.sha }} + docker push ghcr.io/${{ github.repository }}/htm-amd64-debian:latest + docker push ghcr.io/${{ github.repository }}/htm-amd64-debian:${{ github.run_number }} + docker push ghcr.io/${{ github.repository }}/htm-amd64-debian:${{ github.sha }} diff --git a/.github/workflows/amd64.yml b/.github/workflows/amd64.yml new file mode 100644 index 0000000000..5b46e1d84a --- /dev/null +++ b/.github/workflows/amd64.yml @@ -0,0 +1,43 @@ +name: AMD64 + +on: + # run every day of the week at 02:00 + schedule: + - cron: 0 2 * * * + workflow_dispatch: + +jobs: + build-amd64-docker: + name: Build for AMD64 on Docker + runs-on: ubuntu-24.04 + steps: + - name: Check Docker and Docker Compose versions + run: | + docker --version + docker compose version + + - uses: actions/checkout@v2 + + - name: AMD64 build + run: | + docker build -t htm-amd64-docker --build-arg arch=amd64 . + + - name: Tests + run: | + docker run htm-amd64-docker python htm_test.py + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Tag and push Docker image + run: | + docker tag htm-amd64-docker ghcr.io/${{ github.repository }}/htm-amd64:latest + docker tag htm-amd64-docker ghcr.io/${{ github.repository }}/htm-amd64:${{ github.run_number }} + docker tag htm-amd64-docker ghcr.io/${{ github.repository }}/htm-amd64:${{ github.sha }} + docker push ghcr.io/${{ github.repository }}/htm-amd64:latest + docker push ghcr.io/${{ github.repository }}/htm-amd64:${{ github.run_number }} + docker push ghcr.io/${{ github.repository }}/htm-amd64:${{ github.sha }} diff --git a/Dockerfile.debian b/Dockerfile.debian new file mode 100644 index 0000000000..b25b4d12be --- /dev/null +++ b/Dockerfile.debian @@ -0,0 +1,40 @@ +## Debian slim variant of the htm.core Docker image. +## +## Produces a glibc-based image where manylinux wheels (nautilus-trader, +## numpy, scipy, etc.) install from pre-built binaries without needing +## clang, rust, or other compilers at CI time. +## +## Build: +## docker build -f Dockerfile.debian -t htm-amd64-debian --build-arg arch=amd64 . +## +## The Alpine Dockerfile remains the default for arm64 and other uses. + +ARG arch=amd64 + +## Stage 0: cross-compile bootstrap (only needed when target != host) +FROM multiarch/qemu-user-static AS bootstrap +ARG arch +LABEL org.opencontainers.image.description="Docker image with a pre-built, tested and packaged community maintained htm.core library" +LABEL org.opencontainers.image.source="https://github.com/htm-community/htm.core" + +## Stage 1: build htm.core on the target platform +FROM --platform=linux/${arch} python:3.13-slim AS build +ARG arch +RUN echo "Building HTM for ${arch}" && uname -a + +ADD . /usr/local/src/htm.core +WORKDIR /usr/local/src/htm.core + +# Install build dependencies +RUN apt-get update && apt-get install -y --no-install-recommends \ + cmake \ + make \ + g++ \ + git \ + && rm -rf /var/lib/apt/lists/* + +# Set environment variable to indicate we're in Docker (for htm_install.py) +ENV DOCKER_CONTAINER=1 + +# Run the htm_install.py script to build and extract build artifacts +RUN python htm_install.py