From a50c94a14d958fe252b0fbce0b7a91149aa49096 Mon Sep 17 00:00:00 2001 From: Leonardo Custodio Date: Tue, 12 Mar 2024 06:33:28 -0700 Subject: [PATCH] changes --- .env | 2 +- .gitattributes | 7 +++++++ Dockerfile | 19 ++++++++++++++----- 3 files changed, 22 insertions(+), 6 deletions(-) create mode 100644 .gitattributes diff --git a/.env b/.env index 8645fcd..60b7c40 100644 --- a/.env +++ b/.env @@ -1,4 +1,4 @@ PLATFORM_KEY=example KEY_PASS=example CONFIG_FILE=/opt/app/config.json -RUST_LOG=wallet=trace +RUST_LOG=wallet_lib=warn diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..bf55f92 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,7 @@ +# Autodetect text files +* text=auto + +# Ensure shell script uses LF. +Dockerfile eol=lf +*.sh eol=lf +.env eol=lf \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index ff23bb2..752e1c3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,5 @@ +# ===== FIRST STAGE ====== + FROM rust:1.76-buster as builder LABEL description="This is the build stage for the wallet. Here we create the binary." @@ -8,14 +10,14 @@ RUN cargo build --release # ===== SECOND STAGE ====== -FROM debian:buster-slim +FROM debian:buster-slim as runner LABEL description="This is the 2nd stage: a very small image where we copy the wallet binary." # reqwest needs libssl and curl is needed to install the ca-certificates # awscli is needed for the start script to retrieve the secrets RUN apt-get update && \ apt-get install -y \ libssl-dev \ - wait-for-it \ + dos2unix \ jq \ curl \ zip && \ @@ -24,11 +26,18 @@ RUN apt-get update && \ unzip /tmp/awscliv2.zip -d /tmp/awscli && \ /tmp/awscli/aws/install && \ rm -rf /tmp/awscli* + RUN rm -rf /var/lib/apt/lists/* -COPY --from=builder /wallet/target/release/wallet /usr/local/bin -COPY --from=builder /wallet/scripts/start.sh /usr/local/bin -RUN chmod +x /usr/local/bin/start.sh +# ===== THIRD STAGE ====== + +FROM runner + +WORKDIR wallet + +COPY --chmod=0755 --from=builder /wallet/target/release/wallet /usr/local/bin +COPY --chmod=0755 --from=builder /wallet/scripts/start.sh /wallet/start.sh +RUN dos2unix start.sh # 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`)