diff --git a/.github/workflows/new_cd.yml b/.github/workflows/new_cd.yml index fd04681f..412edb90 100644 --- a/.github/workflows/new_cd.yml +++ b/.github/workflows/new_cd.yml @@ -18,8 +18,10 @@ jobs: uses: docker/setup-qemu-action@v3 - name: Setup Docker Buildx uses: docker/setup-buildx-action@v3 + - name: Create compose file + run: contrib/gen-docker-compose.sh linux/arm64 > docker-compose.yml - name: Run compose file run: | - docker compose -f contrib/docker-compose.yml --project-directory . up + docker compose up diff --git a/contrib/gen-docker-compose.sh b/contrib/gen-docker-compose.sh new file mode 100755 index 00000000..7f1df74b --- /dev/null +++ b/contrib/gen-docker-compose.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +if [ -z "$1" ] +then + echo "Usage $0 [features]" + exit 1 +fi + +platform="$1" +features="$2" + +if [ -z "$features" ] +then + features="alsa_backend" +fi + +dependencies=(libssl-dev pkg-config) + +if [[ $features == *"alsa_backend"** ]] +then + dependencies+=("libasound2-dev") +fi + +cat << END_FILE +services: + build-container: + image: rust:bookworm + platform: $platform + command: bash -c " + apt-get update && + apt-get install -y ${dependencies[*]} && + cargo build --release --no-default-features --features $features" + working_dir: /spotifyd + volumes: + - ./:/build +END_FILE