Skip to content
This repository has been archived by the owner on Sep 2, 2024. It is now read-only.

fix: build proper Docker image for arm64 #501

Merged
merged 6 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .github/workflows/multiplatform.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
name: Multiplatform Docker build & push
on:
workflow_dispatch:
push:
release:
types: [published]
jobs:
build:
env:
REGISTRY: ghcr.io
IMAGENAME: ${{ github.event.repository.name }}
TAG: ${{ github.ref_name }}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The IMAGENAME is the same as our existing docker file? should we remove the old workflow then since this seems to do both?

Initially I thought we'd only run this one on release as it's slower, but I'm not sure if it's worthwhile to do this and have to maintain two separate workflows

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's probably a good idea to make sure all platforms compile as well. @rdmitr does this make sense to you? let's remove the other docker workflow?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rolznz Yeah, I didn't change this part. Found it a bit surprising but left it anyways. I guess the other Docker workflow is safe to delete

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -21,6 +22,7 @@ jobs:
- name: Run tests
run: mkdir frontend/dist && touch frontend/dist/tmp && go test ./...
- name: Docker build
if: github.actor != 'dependabot[bot]'
uses: mr-smithers-excellent/docker-build-push@v6
id: build
with:
Expand All @@ -30,4 +32,5 @@ jobs:
platform: linux/amd64,linux/arm64
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
addLatest: ${{ github.ref == 'refs/heads/master' }}
addLatest: ${{ startsWith(github.ref, 'refs/tags/v') }}
buildArgs: TAG=${{ env.TAG }}
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 16 additions & 0 deletions build/docker/copy_dylibs.sh
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/breez/breez-sdk-go v0.3.4
github.com/davrux/echo-logrus/v4 v4.0.3
github.com/elnosh/gonuts v0.1.1-0.20240602162005-49da741613e4
github.com/getAlby/glalby-go v0.0.0-20240616134525-322750d01f8d
github.com/getAlby/glalby-go v0.0.0-20240621192717-95673c864d59
github.com/getAlby/ldk-node-go v0.0.0-20240624140557-d51c707f10d9
github.com/go-gormigrate/gormigrate/v2 v2.1.2
github.com/gorilla/sessions v1.2.2
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwV
github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU=
github.com/getAlby/glalby-go v0.0.0-20240616134525-322750d01f8d h1:ouIUrgIJXgf+foCDfOU67oNSraBeED15vCoPvaanU1I=
github.com/getAlby/glalby-go v0.0.0-20240616134525-322750d01f8d/go.mod h1:ViyJvjlvv0GCesTJ7mb3fBo4G+/qsujDAFN90xZ7a9U=
github.com/getAlby/glalby-go v0.0.0-20240621192717-95673c864d59 h1:fSqdXE9uKhLcOOQaLtzN+D8RN3oEcZQkGX5E8PyiKy0=
github.com/getAlby/glalby-go v0.0.0-20240621192717-95673c864d59/go.mod h1:ViyJvjlvv0GCesTJ7mb3fBo4G+/qsujDAFN90xZ7a9U=
github.com/getAlby/ldk-node-go v0.0.0-20240624050304-d2810786ce55 h1:hDsk9Yn2FvxZ0fz/0+7Dv+Xdfha73krDuL8MhG70I6c=
github.com/getAlby/ldk-node-go v0.0.0-20240624050304-d2810786ce55/go.mod h1:8BRjtKcz8E0RyYTPEbMS8VIdgredcGSLne8vHDtcRLg=
github.com/getAlby/ldk-node-go v0.0.0-20240624140557-d51c707f10d9 h1:fxJ8kvYG9gQ0bLQa0N2gCHq2usCB//oLjST+PUMUcnQ=
Expand Down
Loading