Skip to content

Commit 03f18c0

Browse files
authored
Add example Dockerfile to build the remote signer (#62)
Adding a Dockerfile to the example remote signing server so the example could be deployed to a cloud infra. Converge ENV names used in the remote signer to the Lightspark standard. Towards LPT-224
1 parent 27e6786 commit 03f18c0

File tree

2 files changed

+37
-5
lines changed

2 files changed

+37
-5
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
FROM --platform=$BUILDPLATFORM rust:1.84-slim-bookworm AS builder
2+
3+
ARG TARGETOS TARGETARCH
4+
RUN echo "$TARGETARCH" | sed 's,arm,aarch,;s,amd,x86_,' > /tmp/arch
5+
6+
RUN apt-get update && apt-get install -y "gcc-$(tr _ - < /tmp/arch)-linux-gnu" "g++-$(tr _ - < /tmp/arch)-linux-gnu" make && apt-get clean && rm -rf /var/lib/apt/lists/*
7+
RUN rustup target add "$(cat /tmp/arch)-unknown-${TARGETOS}-gnu"
8+
9+
WORKDIR /usr/src/remote-signer
10+
11+
COPY Cargo.toml Cargo.lock .
12+
COPY examples/ examples
13+
COPY lightspark/ lightspark
14+
COPY lightspark-remote-signing/ lightspark-remote-signing/
15+
16+
RUN cargo build -r --bin lightspark-remote-signing-server
17+
18+
FROM debian:bookworm-slim
19+
20+
RUN apt-get update && apt-get install -y ca-certificates bash htop && apt-get clean && rm -rf /var/lib/apt/lists/*
21+
RUN addgroup --system --gid 1000 sparknode
22+
RUN adduser --system --uid 1000 --home /home/sparknode --ingroup sparknode sparknode
23+
24+
ENTRYPOINT ["remote-signing-server"]
25+
EXPOSE 8000
26+
27+
COPY --from=builder /usr/src/remote-signer/target/release/lightspark-remote-signing-server /usr/local/bin/remote-signing-server
28+
29+
# Install security updates
30+
RUN apt-get update && apt-get -y upgrade && apt-get clean && rm -rf /var/lib/apt/lists
31+
32+
RUN remote-signing-server

examples/lightspark-remote-signing-server/src/config.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ pub struct Config {
1111

1212
impl Config {
1313
pub fn new_from_env() -> Self {
14-
let api_endpoint = std::env::var("RK_API_ENDPOINT").ok();
15-
let api_client_id = std::env::var("RK_API_CLIENT_ID").ok();
16-
let api_client_secret = std::env::var("RK_API_CLIENT_SECRET").ok();
17-
let webhook_secret = std::env::var("RK_WEBHOOK_SECRET").ok();
18-
let master_seed_hex = std::env::var("RK_MASTER_SEED_HEX").ok();
14+
let api_endpoint = std::env::var("API_ENDPOINT").ok();
15+
let api_client_id = std::env::var("API_CLIENT_ID").ok();
16+
let api_client_secret = std::env::var("API_CLIENT_SECRET").ok();
17+
let webhook_secret = std::env::var("WEBHOOK_SECRET").ok();
18+
let master_seed_hex = std::env::var("MASTER_SEED_HEX").ok();
1919
let api_port = std::env::var("PORT").ok();
2020
let respond_directly = std::env::var("RESPOND_DIRECTLY").is_ok();
2121

0 commit comments

Comments
 (0)