Skip to content

Commit

Permalink
Merge pull request #233 from getAlby/feat/onboarding-flow
Browse files Browse the repository at this point in the history
feat: basic onboarding flow
  • Loading branch information
rolznz authored Jan 30, 2024
2 parents 0ef85e2 + 717f369 commit 33ce4db
Show file tree
Hide file tree
Showing 30 changed files with 456 additions and 2,025 deletions.
51 changes: 51 additions & 0 deletions .do/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
FROM node:19-alpine as frontend
WORKDIR /build
COPY frontend ./frontend
RUN cd frontend && yarn install && yarn build:http

FROM golang:1.21 as builder

ARG TARGETPLATFORM
ARG BUILDPLATFORM

RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM"

RUN apt-get update && \
apt-get install -y gcc

ENV CGO_ENABLED=1
ENV GOOS=linux
#ENV GOARCH=$GOARCH

#RUN echo "AAA $GOARCH"

# Move to working directory /build
WORKDIR /build

# Copy and download dependency using go mod
COPY go.mod .
COPY go.sum .
RUN GOARCH=$(echo "$TARGETPLATFORM" | cut -d'/' -f2) go mod download

# Copy the code into the container
COPY . .

# Copy frontend dist files into the container
COPY --from=frontend /build/frontend/dist ./frontend/dist

RUN GOARCH=$(echo "$TARGETPLATFORM" | cut -d'/' -f2) go build -o main .

RUN wget https://github.com/breez/breez-sdk-go/raw/main/breez_sdk/lib/linux-amd64/libbreez_sdk_bindings.so

# Start a new, final image to reduce size.
FROM debian as final


ENV LD_LIBRARY_PATH=/usr/lib/libbreez
#
# # Copy the binaries and entrypoint from the builder image.
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /build/libbreez_sdk_bindings.so /usr/lib/libbreez/
COPY --from=builder /build/main /bin/

ENTRYPOINT [ "/bin/main" ]
9 changes: 5 additions & 4 deletions .do/app.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: nwc
services:
- name: web
github:
repo: getAlby/nostr-wallet-connect
branch: server-self-host
- name: web
github:
repo: getAlby/nostr-wallet-connect
branch: feat/onboarding-flow
dockerfile_path: .do/Dockerfile
20 changes: 4 additions & 16 deletions .do/deploy.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,7 @@ spec:
name: nwc
services:
- name: web
git:
branch: server-self-host
repo_clone_url: https://github.com/getAlby/nostr-wallet-connect.git
envs:
- key: RELAY
value: "RELAY=wss://relay.getalby.com/v1"
scope: RUN_TIME
- key: LN_BACKEND_TYPE
value: BREEZ
scope: RUN_TIME
- key: COOKIE_SECRET
scope: RUN_TIME
- key: GREENLIGHT_INVITE_CODE
scope: RUN_TIME
- key: BREEZ_MNEMONIC
scope: RUN_TIME
github:
branch: feat/onboarding-flow
repo: getAlby/nostr-wallet-connect
deploy_on_push: true
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v1
with:
go-version: 1.20.x
go-version: 1.21.x
- name: Checkout code
uses: actions/checkout@v2
- name: Run tests
Expand Down
58 changes: 58 additions & 0 deletions .github/workflows/wails.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Wails build
on:
push:
release:
types: [published]
jobs:
build:
strategy:
fail-fast: false
matrix:
build: [
{ name: nostr-wallet-connect, platform: linux/amd64, os: ubuntu-latest },
]
env:
REGISTRY: ghcr.io
IMAGENAME: ${{ github.event.repository.name }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
name: Check out code
- name: Setup GoLang
uses: actions/setup-go@v4
with:
check-latest: true
go-version: 1.21
# Setup and configure NodeJS
- name: Setup NodeJS
uses: actions/setup-node@v3
with:
node-version: 18.x
- name: Install Wails
run: go install github.com/wailsapp/wails/v2/cmd/wails@latest
shell: bash
- name: Install Linux Wails deps
run: sudo apt-get update && sudo apt-get install libgtk-3-0 libwebkit2gtk-4.0-dev gcc-aarch64-linux-gnu libgtk-3-dev nsis
shell: bash
- name: Wails Doctor
working-directory: .
run: wails doctor
shell: bash
# Building step
- name: Build App
working-directory: .
run: wails build --platform ${{ matrix.build.platform }} -tags "wails"
#-o ${{ matrix.build.name }}
shell: bash
- uses: actions/upload-artifact@v3
with:
name: Wails Build ${{runner.os}} nostr-wallet-connect
path: |
*/bin/
*\bin\*
# - uses: dAppServer/[email protected]
# with:
# build-name: ${{ matrix.build.name }}
# build-platform: ${{ matrix.build.platform }}
# package: false
# go-version: '1.21'
64 changes: 0 additions & 64 deletions .github/workflows/workflow.yaml

This file was deleted.

3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"editor.defaultFormatter": "golang.go"
},
"editor.formatOnSave": true,
"go.buildTags": "http,wails"
"go.buildTags": "http,wails",
"typescript.preferences.importModuleSpecifier": "non-relative"
}
34 changes: 22 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,41 +1,51 @@
FROM node:18-alpine as frontend
FROM node:19-alpine as frontend
WORKDIR /build
COPY frontend ./frontend
RUN cd frontend && yarn install && yarn build
RUN cd frontend && yarn install && yarn build:http

FROM golang:latest as builder
FROM golang:1.21 as builder

ARG TARGETPLATFORM
ARG BUILDPLATFORM

RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM"

RUN apt-get update && \
apt-get install -y gcc
apt-get install -y gcc

ENV CGO_ENABLED=1
ENV GOOS=linux
ENV GOARCH=amd64
#ENV GOARCH=$GOARCH

#RUN echo "AAA $GOARCH"

# Move to working directory /build
WORKDIR /build

# Copy and download dependency using go mod
COPY go.mod .
COPY go.sum .
RUN go mod download
RUN GOARCH=$(echo "$TARGETPLATFORM" | cut -d'/' -f2) go mod download

# Copy the code into the container
COPY . .

# Copy frontend dist files into the container
COPY --from=frontend /build/frontend/dist ./frontend/dist

RUN go build -o main .
RUN GOARCH=$(echo "$TARGETPLATFORM" | cut -d'/' -f2) go build -o main .

# Start a new, final image to reduce size.
FROM alpine as final
RUN wget https://github.com/breez/breez-sdk-go/raw/main/breez_sdk/lib/linux-amd64/libbreez_sdk_bindings.so

# FROM gcr.io/distroless/static-debian11
# Start a new, final image to reduce size.
FROM debian as final

# USER small-user:small-user

# Copy the binaries and entrypoint from the builder image.
ENV LD_LIBRARY_PATH=/usr/lib/libbreez
#
# # Copy the binaries and entrypoint from the builder image.
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /build/libbreez_sdk_bindings.so /usr/lib/libbreez/
COPY --from=builder /build/main /bin/

ENTRYPOINT [ "/bin/main" ]
Loading

0 comments on commit 33ce4db

Please sign in to comment.