Skip to content

Commit

Permalink
cd: extract compose file generation to script
Browse files Browse the repository at this point in the history
  • Loading branch information
eladyn committed Dec 30, 2024
1 parent 6e60ca9 commit 4a7ab26
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .github/workflows/new_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
36 changes: 36 additions & 0 deletions contrib/gen-docker-compose.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

if [ -z "$1" ]
then
echo "Usage $0 <platform> [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

0 comments on commit 4a7ab26

Please sign in to comment.