raspi4 build added

This commit is contained in:
euzu
2024-12-07 13:03:14 +01:00
parent 39d22bef8c
commit 78f9347170
4 changed files with 76 additions and 12 deletions
+16 -11
View File
@@ -3,9 +3,11 @@ set -euo pipefail
source "${HOME}/.ghcr.io"
PLATFORM=x86_64-unknown-linux-musl
# Check if the binary exists
if [ ! -f "./target/x86_64-unknown-linux-musl/release/m3u-filter" ]; then
echo "Error: Static binary '../target/x86_64-unknown-linux-musl/release/m3u-filter' does not exist."
if [ ! -f "./target/${PLATFORM}/release/m3u-filter" ]; then
echo "Error: Static binary '../target/${PLATFORM}/release/m3u-filter' does not exist."
exit 1
fi
@@ -17,7 +19,7 @@ fi
# Prepare Docker build context
cd ./docker
cp ../target/x86_64-unknown-linux-musl/release/m3u-filter .
cp ../target/${PLATFORM}/release/m3u-filter .
rm -rf ./web
cp -r ../frontend/build ./web
@@ -30,24 +32,27 @@ fi
echo "Building Docker images for version ${VERSION}"
SCRATCH_IMAGE_NAME=m3u-filter
ALPINE_IMAGE_NAME=m3u-filter-alpine
# Build scratch image and tag as "latest"
docker build -f Dockerfile-manual -t ghcr.io/euzu/m3u-filter:"${VERSION}" --target scratch-final .
docker tag ghcr.io/euzu/m3u-filter:"${VERSION}" ghcr.io/euzu/m3u-filter:latest
docker build -f Dockerfile-manual -t ghcr.io/euzu/${SCRATCH_IMAGE_NAME}:"${VERSION}" --target scratch-final .
docker tag ghcr.io/euzu/${SCRATCH_IMAGE_NAME}:"${VERSION}" ghcr.io/euzu/${SCRATCH_IMAGE_NAME}:latest
# Build alpine image and tag as "latest"
docker build -f Dockerfile-manual -t ghcr.io/euzu/m3u-filter-alpine:"${VERSION}" --target alpine-final .
docker tag ghcr.io/euzu/m3u-filter-alpine:"${VERSION}" ghcr.io/euzu/m3u-filter-alpine:latest
docker build -f Dockerfile-manual -t ghcr.io/euzu/${ALPINE_IMAGE_NAME}:"${VERSION}" --target alpine-final .
docker tag ghcr.io/euzu/${ALPINE_IMAGE_NAME}:"${VERSION}" ghcr.io/euzu/${ALPINE_IMAGE_NAME}:latest
echo "Logging into GitHub Container Registry..."
docker login ghcr.io -u euzu -p "${GHCR_IO_TOKEN}"
# Push scratch
docker push ghcr.io/euzu/m3u-filter:"${VERSION}"
docker push ghcr.io/euzu/m3u-filter:latest
docker push ghcr.io/euzu/${SCRATCH_IMAGE_NAME}:"${VERSION}"
docker push ghcr.io/euzu/${SCRATCH_IMAGE_NAME}:latest
# Push alpine
docker push ghcr.io/euzu/m3u-filter-alpine:"${VERSION}"
docker push ghcr.io/euzu/m3u-filter-alpine:latest
docker push ghcr.io/euzu/${ALPINE_IMAGE_NAME}:"${VERSION}"
docker push ghcr.io/euzu/${ALPINE_IMAGE_NAME}:latest
# Clean up
echo "Cleaning up build artifacts..."
+53
View File
@@ -0,0 +1,53 @@
#!/bin/bash
set -euo pipefail
source "${HOME}/.ghcr.io"
PLATFORM=aarch64-unknown-linux-musl
# Check if the binary exists
if [ ! -f "./target/${PLATFORM}/release/m3u-filter" ]; then
echo "Error: Static binary '../target/${PLATFORM}/release/m3u-filter' does not exist."
exit 1
fi
# Check if the frontend build directory exists
if [ ! -d "./frontend/build" ]; then
echo "Error: Web directory '../frontend/build' does not exist."
exit 1
fi
# Prepare Docker build context
cd ./docker
cp ../target/${PLATFORM}/release/m3u-filter .
rm -rf ./web
cp -r ../frontend/build ./web
# Get the version from the binary
VERSION=$(./m3u-filter -V | sed 's/m3u-filter *//')
if [ -z "${VERSION}" ]; then
echo "Error: Failed to determine the version from the binary."
exit 1
fi
echo "Building Docker images for version ${VERSION}"
SCRATCH_IMAGE_NAME=m3u-filter-aarch64
# Build scratch image and tag as "latest"
docker build -f Dockerfile-manual -t ghcr.io/euzu/${SCRATCH_IMAGE_NAME}:"${VERSION}" --target scratch-final .
docker tag ghcr.io/euzu/${SCRATCH_IMAGE_NAME}:"${VERSION}" ghcr.io/euzu/${SCRATCH_IMAGE_NAME}:latest
echo "Logging into GitHub Container Registry..."
docker login ghcr.io -u euzu -p "${GHCR_IO_TOKEN}"
# Push scratch
docker push ghcr.io/euzu/${SCRATCH_IMAGE_NAME}:"${VERSION}"
docker push ghcr.io/euzu/${SCRATCH_IMAGE_NAME}:latest
# Clean up
echo "Cleaning up build artifacts..."
rm -rf ./web
rm -f ./m3u-filter
echo "Docker images for version ${VERSION} have been successfully built, tagged, and pushed."
+4 -1
View File
@@ -1,2 +1,5 @@
#!/usr/bin/env bash
env RUSTFLAGS="--remap-path-prefix $HOME=~" cross build --release --target armv7-unknown-linux-musleabihf
#echo "building binary for raspi armv7"
#env RUSTFLAGS="--remap-path-prefix $HOME=~" cross build --release --target armv7-unknown-linux-musleabihf
echo "building binary for raspi aarch64"
env RUSTFLAGS="--remap-path-prefix $HOME=~" cross build --release --target aarch64-unknown-linux-musl
+3
View File
@@ -25,18 +25,21 @@ declare -A DIRS=(
[LINUX]=m3u-filter_${VERSION}_linux_x86_64
[WINDOWS]=m3u-filter_${VERSION}_windows_x86_64
[RASPI]=m3u-filter_${VERSION}_armv7_raspi
[RASPI4]=m3u-filter_${VERSION}_aarch64_raspi
)
declare -A ARCS=(
[LINUX]=${DIRS[LINUX]}.tgz
[WINDOWS]=${DIRS[WINDOWS]}.zip
[RASPI]=${DIRS[RASPI]}.tgz
[RASPI4]=${DIRS[RASPI4]}.tgz
)
declare -A BINARIES=(
[LINUX]=x86_64-unknown-linux-musl/release/m3u-filter
[WINDOWS]=x86_64-pc-windows-gnu/release/m3u-filter.exe
[RASPI]=armv7-unknown-linux-musleabihf/release/m3u-filter
[RASPI4]=aarch64-unknown-linux-musl/release/m3u-filter
)
# Build binaries