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

Commit

Permalink
Add linux support in SystemArchitecture.set(), add Dockerfile's in ex…
Browse files Browse the repository at this point in the history
…ample
  • Loading branch information
KendallWeihe committed Jul 5, 2024
1 parent 6bf2a07 commit b28ba5c
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bound/kt/src/main/kotlin/tbdex/sdk/rust/SystemArchitecture.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ object SystemArchitecture {
val osReleaseContent = osRelease.readText().lowercase()
when {
osReleaseContent.contains("ubuntu") ->
throw Exception("Ubuntu amd64 not yet supported")
System.setProperty("uniffi.component.tbdex.libraryOverride", "tbdex_uniffi_x86_64_unknown_linux_gnu")

osReleaseContent.contains("alpine") ->
throw Exception("Alpine amd64 not yet supported")
System.setProperty("uniffi.component.tbdex.libraryOverride", "tbdex_uniffi_x86_64_unknown_linux_musl")

else -> throw Exception("Unsupported OS arch $osReleaseContent")
}
Expand Down
28 changes: 28 additions & 0 deletions examples/hosted-wallet-kt/DockerfileAlpine
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FROM --platform=linux/amd64 alpine:latest

# Install dependencies
RUN apk update && apk add --no-cache \
openjdk17 \
gradle \
maven \
git \
bash

# Copy application code
COPY bound/kt /app/bound/kt
COPY examples/hosted-wallet-kt /app/examples/hosted-wallet-kt

# Build the bound/kt project
WORKDIR /app/bound/kt
RUN mvn install

# Build the hosted-wallet-kt project
WORKDIR /app/examples/hosted-wallet-kt
RUN ./gradlew build

# Expose ports
EXPOSE 8081
EXPOSE 8082

# Set the default command
CMD ["bash"]
21 changes: 21 additions & 0 deletions examples/hosted-wallet-kt/DockerfileUbuntu
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM --platform=linux/amd64 ubuntu:22.04

RUN apt-get update && apt-get install -y \
openjdk-17-jdk \
gradle \
maven \
git

COPY bound/kt /app/bound/kt
COPY examples/hosted-wallet-kt /app/examples/hosted-wallet-kt

WORKDIR /app/bound/kt
RUN mvn install

WORKDIR /app/examples/hosted-wallet-kt
RUN ./gradlew build

EXPOSE 8081
EXPOSE 8082

CMD ["bash"]
13 changes: 13 additions & 0 deletions examples/hosted-wallet-kt/docker-alpine
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

# Create the network
docker network create hosted-wallet-kt-alpine-network

# Build the image
docker build -f DockerfileAlpine -t hosted-wallet-kt-alpine ../../

# Run the pfi application
docker run -d --name pfi-app-alpine --network hosted-wallet-kt-alpine-network -p 8082:8082 hosted-wallet-kt-alpine ./gradlew :pfi:run

# Run the wallet application
docker run -d --name wallet-app-alpine --network hosted-wallet-kt-alpine-network -p 8081:8081 hosted-wallet-kt-alpine ./gradlew :wallet:run
13 changes: 13 additions & 0 deletions examples/hosted-wallet-kt/docker-ubuntu
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

# Create the network
docker network create hosted-wallet-kt-ubuntu-network

# Build the image
docker build -f DockerfileUbuntu -t hosted-wallet-kt-ubuntu ../../

# Run the pfi application
docker run -d --name pfi-app-ubuntu --network hosted-wallet-kt-ubuntu-network -p 8082:8082 hosted-wallet-kt-ubuntu ./gradlew :pfi:run

# Run the wallet application
docker run -d --name wallet-app-ubuntu --network hosted-wallet-kt-ubuntu-network -p 8081:8081 hosted-wallet-kt-ubuntu ./gradlew :wallet:run

0 comments on commit b28ba5c

Please sign in to comment.