Skip to content

Commit

Permalink
[PLA-1619] Improves wallet daemon docker (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardocustodio authored Feb 15, 2024
1 parent ab97c39 commit 549da74
Show file tree
Hide file tree
Showing 16 changed files with 40 additions and 94 deletions.
6 changes: 1 addition & 5 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
target/
integration-tests/
store/
config.json
config-testnet.json
data-staging/
docker/
config-test.json
4 changes: 4 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
PLATFORM_KEY=example
KEY_PASS=example
CONFIG_FILE=/opt/app/config.json
RUST_LOG=wallet=trace
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
.idea/
target/
alternative_store/
.cargo/
target/
node_modules
build/
integration-tests/test/chains/
store/
15 changes: 8 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 6 additions & 10 deletions docker/Dockerfile → Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
FROM rust:1.59.0-buster as builder
FROM rust:1.76-buster as builder
LABEL description="This is the build stage for the wallet. Here we create the binary."

ARG PROFILE=release
WORKDIR /wallet

ENV CARGO_HOME=/wallet/.cargo
COPY . .

RUN cargo build --$PROFILE --package bin
RUN cargo build --release

# ===== SECOND STAGE ======

Expand All @@ -28,15 +25,14 @@ RUN apt-get update && \
/tmp/awscli/aws/install && \
rm -rf /tmp/awscli*
RUN rm -rf /var/lib/apt/lists/*
ARG PROFILE=release

COPY --from=builder /wallet/target/$PROFILE/wallet /usr/local/bin
COPY --from=builder /wallet/data/start.sh /usr/local/bin
ENTRYPOINT ["start.sh"]
COPY --from=builder /wallet/target/release/wallet /usr/local/bin
COPY --from=builder /wallet/scripts/start.sh /usr/local/bin

# STORE_NAME = the storage name, this is a hex number which is the file name where the key is stored,
# it's generated when the key is generate (In the current example: `73723235301cb3057d43941d5f631613aa1661be0354d39e34f23d4ef527396b10d2bb7a`)
# SEED_PHRASE = These are the content of the key file, which are the bip-39 words used to generate the key.
# (In the current example: "duty captain man fantasy angry window release hammer suspect bullet panda special")
# KEY_PASS = The pass of the key which when originally generated is set through the `KEY_PASS` env variable. (In the current example: `example`)
# PLATFORM_KEY = The platform key is the API token used to authenticate the wallet daemon so it can request new transactions from the platform to sign.
CMD ["STORE_NAME", "SEED_PHRASE", "KEY_PASS", "PLATFORM_KEY"]
CMD ["start.sh"]
1 change: 1 addition & 0 deletions bin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ path = "src/wallet.rs"

[dependencies]
wallet_lib = { path = "../lib" }
rtoolbox = "0.0.2"
rpassword = "7.3"
tokio = { version = "1.28.0", default-features = false, features = [
"rt",
Expand Down
6 changes: 3 additions & 3 deletions config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"node": "wss://rpc.matrix.canary.enjin.io:443",
"api": "http://localhost:8000/graphql",
"master_key": "store"
"node": "wss://rpc.matrix.blockchain.enjin.io:443",
"api": "https://platform.enjin.io/graphql",
"master_key": "/opt/app/storage"
}
28 changes: 0 additions & 28 deletions data/start.sh

This file was deleted.

12 changes: 12 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: '3.9'

services:
daemon:
image: enjin/daemon:latest
build:
context: .
env_file:
- .env
volumes:
- ./config.json:/opt/app/config.json
- ./store:/opt/app/storage
5 changes: 0 additions & 5 deletions docker/.env

This file was deleted.

19 changes: 0 additions & 19 deletions docker/build.sh

This file was deleted.

5 changes: 0 additions & 5 deletions docker/config.json

This file was deleted.

8 changes: 0 additions & 8 deletions docker/docker-compose.yml

This file was deleted.

3 changes: 3 additions & 0 deletions scripts/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

wallet
Empty file added store/.gitkeep
Empty file.

This file was deleted.

0 comments on commit 549da74

Please sign in to comment.