diff --git a/.github/workflows/build-docker.yaml b/.github/workflows/build-docker.yaml index f4e1e2e9..3058e47d 100644 --- a/.github/workflows/build-docker.yaml +++ b/.github/workflows/build-docker.yaml @@ -1,4 +1,4 @@ -name: Linux-amd64 Docker build & push +name: Multiplatform Docker build & push on: push: release: @@ -28,7 +28,8 @@ jobs: with: image: ${{ env.IMAGENAME }} registry: ${{ env.REGISTRY }} - platform: linux/amd64 + multiPlatform: true + platform: linux/amd64,linux/arm64 username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} addLatest: ${{ startsWith(github.ref, 'refs/tags/v') }} diff --git a/.github/workflows/multiplatform.yaml b/.github/workflows/multiplatform.yaml deleted file mode 100644 index e8f94cd1..00000000 --- a/.github/workflows/multiplatform.yaml +++ /dev/null @@ -1,33 +0,0 @@ -name: Multiplatform Docker build & push -on: - workflow_dispatch: - release: - types: [published] -jobs: - build: - env: - REGISTRY: ghcr.io - IMAGENAME: ${{ github.event.repository.name }} - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - name: Check out code - - name: Install Go - uses: actions/setup-go@v1 - with: - go-version: 1.21.x - - name: Checkout code - uses: actions/checkout@v2 - - name: Run tests - run: mkdir frontend/dist && touch frontend/dist/tmp && go test ./... - - name: Docker build - uses: mr-smithers-excellent/docker-build-push@v6 - id: build - with: - image: ${{ env.IMAGENAME }} - registry: ${{ env.REGISTRY }} - multiPlatform: true - platform: linux/amd64,linux/arm64 - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - addLatest: ${{ github.ref == 'refs/heads/master' }} diff --git a/Dockerfile b/Dockerfile index eaa9185c..13844502 100644 --- a/Dockerfile +++ b/Dockerfile @@ -38,9 +38,9 @@ RUN GOARCH=$(echo "$TARGETPLATFORM" | cut -d'/' -f2) go build \ -ldflags="-X 'github.com/getAlby/nostr-wallet-connect/version.Tag=$TAG'" \ -o main cmd/http/main.go -RUN cp `find /go/pkg/mod/github.com/breez/ |grep linux-amd64 |grep libbreez_sdk_bindings.so` ./ -RUN cp `find /go/pkg/mod/github.com/get\!alby/ | grep x86_64-unknown-linux-gnu | grep libglalby_bindings.so` ./ -RUN cp `find /go/pkg/mod/github.com/get\!alby/ | grep x86_64-unknown-linux-gnu | grep libldk_node.so` ./ +COPY ./build/docker/copy_dylibs.sh . +RUN chmod +x copy_dylibs.sh +RUN ./copy_dylibs.sh $(echo "$TARGETPLATFORM" | cut -d'/' -f2) # Start a new, final image to reduce size. FROM debian as final diff --git a/build/docker/copy_dylibs.sh b/build/docker/copy_dylibs.sh new file mode 100644 index 00000000..d649960c --- /dev/null +++ b/build/docker/copy_dylibs.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +ARCH="$1" + +if [[ "$ARCH" == "amd64" ]]; then + cp "$(go list -m -f "{{.Dir}}" github.com/breez/breez-sdk-go)"/breez_sdk/lib/linux-amd64/libbreez_sdk_bindings.so ./ + cp "$(go list -m -f "{{.Dir}}" github.com/getAlby/glalby-go)"/glalby/x86_64-unknown-linux-gnu/libglalby_bindings.so ./ + cp "$(go list -m -f "{{.Dir}}" github.com/getAlby/ldk-node-go)"/ldk_node/x86_64-unknown-linux-gnu/libldk_node.so ./ +elif [[ "$ARCH" == "arm64" ]]; then + cp "$(go list -m -f "{{.Dir}}" github.com/breez/breez-sdk-go)"/breez_sdk/lib/linux-aarch64/libbreez_sdk_bindings.so ./ + cp "$(go list -m -f "{{.Dir}}" github.com/getAlby/glalby-go)"/glalby/aarch64-unknown-linux-gnu/libglalby_bindings.so ./ + cp "$(go list -m -f "{{.Dir}}" github.com/getAlby/ldk-node-go)"/ldk_node/aarch64-unknown-linux-gnu/libldk_node.so ./ +else + echo "Invalid ARCH value" + exit 1 +fi