Fix Docker build: Add passwd package and skip user creation #8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build BlazeNeuro (Docker) | |
| on: | |
| push: | |
| branches: [main, develop] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 360 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Free disk space | |
| run: | | |
| sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /usr/local/share/boost | |
| sudo apt-get clean | |
| df -h | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Download sources | |
| run: | | |
| mkdir -p sources | |
| cd sources | |
| declare -A urls=( | |
| ["binutils-2.42.tar.xz"]="https://mirrors.kernel.org/gnu/binutils/binutils-2.42.tar.xz|https://ftpmirror.gnu.org/binutils/binutils-2.42.tar.xz" | |
| ["gcc-13.2.0.tar.xz"]="https://mirrors.kernel.org/gnu/gcc/gcc-13.2.0/gcc-13.2.0.tar.xz|https://ftpmirror.gnu.org/gcc/gcc-13.2.0/gcc-13.2.0.tar.xz" | |
| ["glibc-2.39.tar.xz"]="https://mirrors.kernel.org/gnu/glibc/glibc-2.39.tar.xz|https://ftpmirror.gnu.org/glibc/glibc-2.39.tar.xz" | |
| ["linux-6.7.4.tar.xz"]="https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.7.4.tar.xz|https://mirrors.edge.kernel.org/pub/linux/kernel/v6.x/linux-6.7.4.tar.xz" | |
| ["bash-5.2.21.tar.gz"]="https://mirrors.kernel.org/gnu/bash/bash-5.2.21.tar.gz|https://ftpmirror.gnu.org/bash/bash-5.2.21.tar.gz" | |
| ["coreutils-9.4.tar.xz"]="https://mirrors.kernel.org/gnu/coreutils/coreutils-9.4.tar.xz|https://ftpmirror.gnu.org/coreutils/coreutils-9.4.tar.xz" | |
| ["findutils-4.9.0.tar.xz"]="https://mirrors.kernel.org/gnu/findutils/findutils-4.9.0.tar.xz|https://ftpmirror.gnu.org/findutils/findutils-4.9.0.tar.xz" | |
| ["grep-3.11.tar.xz"]="https://mirrors.kernel.org/gnu/grep/grep-3.11.tar.xz|https://ftpmirror.gnu.org/grep/grep-3.11.tar.xz" | |
| ["gzip-1.13.tar.xz"]="https://mirrors.kernel.org/gnu/gzip/gzip-1.13.tar.xz|https://ftpmirror.gnu.org/gzip/gzip-1.13.tar.xz" | |
| ["tar-1.35.tar.xz"]="https://mirrors.kernel.org/gnu/tar/tar-1.35.tar.xz|https://ftpmirror.gnu.org/tar/tar-1.35.tar.xz" | |
| ["xz-5.4.6.tar.xz"]="https://github.com/tukaani-project/xz/releases/download/v5.4.6/xz-5.4.6.tar.xz|https://tukaani.org/xz/xz-5.4.6.tar.xz" | |
| ["util-linux-2.39.3.tar.xz"]="https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/v2.39/util-linux-2.39.3.tar.xz|https://www.kernel.org/pub/linux/utils/util-linux/v2.39/util-linux-2.39.3.tar.xz" | |
| ["e2fsprogs-1.47.0.tar.gz"]="https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.47.0/e2fsprogs-1.47.0.tar.gz|https://downloads.sourceforge.net/project/e2fsprogs/e2fsprogs/v1.47.0/e2fsprogs-1.47.0.tar.gz" | |
| ["grub-2.12.tar.xz"]="https://mirrors.kernel.org/gnu/grub/grub-2.12.tar.xz|https://ftpmirror.gnu.org/grub/grub-2.12.tar.xz" | |
| ) | |
| for file in "${!urls[@]}"; do | |
| [ -f "$file" ] && echo "$file exists, skipping" && continue | |
| IFS='|' read -ra MIRRORS <<< "${urls[$file]}" | |
| echo "Downloading $file" | |
| success=0 | |
| for mirror in "${MIRRORS[@]}"; do | |
| if wget --continue --tries=3 --timeout=20 --waitretry=2 "$mirror" -O "$file" 2>&1; then | |
| success=1 | |
| break | |
| fi | |
| echo "Failed from $mirror, trying next..." | |
| rm -f "$file" | |
| done | |
| [ $success -eq 0 ] && { echo "All mirrors failed for $file"; exit 1; } | |
| if [[ "$file" == *.xz ]]; then | |
| xz -t "$file" || { echo "Corrupt: $file"; rm -f "$file"; exit 1; } | |
| elif [[ "$file" == *.gz ]]; then | |
| gzip -t "$file" || { echo "Corrupt: $file"; rm -f "$file"; exit 1; } | |
| fi | |
| done | |
| ls -lh | |
| - name: Build Docker image | |
| run: | | |
| docker build -t blazeneuro-builder . || exit 1 | |
| - name: Extract build artifact | |
| run: | | |
| docker create --name blazeneuro blazeneuro-builder | |
| docker cp blazeneuro:/blazeneuro-rootfs.tar.gz . || exit 1 | |
| docker rm blazeneuro | |
| - name: Upload build logs | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-logs | |
| path: logs/ | |
| retention-days: 7 | |
| if-no-files-found: warn | |
| - name: Upload system image | |
| if: success() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: blazeneuro-system | |
| path: blazeneuro-rootfs.tar.gz | |
| retention-days: 30 |