-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use latest lilypad binary with every deploy (#4)
* chore: add docker ignore * feat: clone lilypad source and build * feat: add local task runner
- Loading branch information
Showing
3 changed files
with
57 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules | ||
README | ||
.github |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
FROM node:20.9.0 | ||
|
||
ARG osarch=amd64 | ||
ARG osname=linux | ||
# lilypad from source | ||
FROM golang:1.22 AS build | ||
RUN go version | ||
RUN git clone https://github.com/Lilypad-Tech/lilypad | ||
RUN cd lilypad && go build -v -o /usr/local/bin/lilypad | ||
|
||
RUN curl https://api.github.com/repos/lilypad-tech/lilypad/releases/latest | grep "browser_download_url.*lilypad-$osname-$osarch" | cut -d : -f 2,3 | tr -d \" | wget -qi - -O lilypad | ||
RUN chmod +x lilypad | ||
RUN mv lilypad /usr/local/bin/lilypad | ||
# node server | ||
FROM node:20.9.0 | ||
WORKDIR app | ||
|
||
COPY . . | ||
|
||
RUN npm install | ||
COPY --from=build /usr/local/bin/lilypad /usr/local/bin/lilypad | ||
|
||
CMD ["node", "./src/index.js"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
IFS=$'\n\t' | ||
|
||
function docker-build() { | ||
docker build \ | ||
-t js-cli-wrapper \ | ||
. | ||
} | ||
|
||
function docker-run() { | ||
docker run \ | ||
--rm \ | ||
--name js-cli-wrapper \ | ||
--add-host localhost:host-gateway \ | ||
-v /tmp/lilypad/data:/tmp/lilypad/data \ | ||
-p 3000:3000 \ | ||
js-cli-wrapper | ||
} | ||
|
||
function dev() { | ||
npm run dev | ||
} | ||
|
||
function run() { | ||
WEB3_PRIVATE_KEY="" | ||
|
||
curl \ | ||
-X POST \ | ||
-H "Content-Type: application/json" \ | ||
-d '{"pk": "'"${WEB3_PRIVATE_KEY}"'", "module": "cowsay:v0.0.4", "inputs": "-i Message=moo" }' \ | ||
http://localhost:3000 | ||
} | ||
|
||
function stream() { | ||
WEB3_PRIVATE_KEY="" | ||
|
||
curl \ | ||
-X POST \ | ||
-H "Content-Type: application/json" \ | ||
-d '{"pk": "'"${WEB3_PRIVATE_KEY}"'", "module": "cowsay:v0.0.4", "inputs": "-i Message=moo", "opts": { "stream": true } }' \ | ||
http://localhost:3000 | ||
} | ||
|
||
eval "$@" |