mirror of
https://github.com/getAlby/hub.git
synced 2026-08-13 12:33:39 +02:00
fix: build proper Docker image for arm64 (#501)
Co-authored-by: Roman Dmitrienko <roman@dmitrienko.com> Co-authored-by: Roland Bewick <roland.bewick@gmail.com>
This commit is contained in:
parent
42d70d53ac
commit
8e577394fb
4 changed files with 22 additions and 38 deletions
5
.github/workflows/build-docker.yaml
vendored
5
.github/workflows/build-docker.yaml
vendored
|
|
@ -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') }}
|
||||
|
|
|
|||
33
.github/workflows/multiplatform.yaml
vendored
33
.github/workflows/multiplatform.yaml
vendored
|
|
@ -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' }}
|
||||
|
|
@ -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
|
||||
|
|
|
|||
16
build/docker/copy_dylibs.sh
Normal file
16
build/docker/copy_dylibs.sh
Normal file
|
|
@ -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
|
||||
Loading…
Add table
Add a link
Reference in a new issue