Skip to content

Commit

Permalink
chore: temporarily download wallet from AWS on build
Browse files Browse the repository at this point in the history
  • Loading branch information
dtfiedler committed May 1, 2024
1 parent cd5e86e commit 61ee002
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ services:
- ./wallets/ao-wallet.json:/usr/app/ao-wallet.json
environment:
- DATABASE_URL=${DATABASE_URL:-postgresql://su_user:su_pass@su-database/su}
- GATEWAY_URL=${GATEWAY_URL:-https://arweave.net/}
- GATEWAY_URL=${GATEWAY_URL:-http://arlocal/}
- UPLOAD_NODE_URL=${UPLOAD_NODE_URL:-https://turbo.ardrive.dev}
- MODE=${MODE:-su}
- DEBUG=${DEBUG:-*}
Expand Down
15 changes: 12 additions & 3 deletions servers/su/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,29 @@ RUN mkdir src && \
# Now copy the actual source code and build the application
COPY src ./src
COPY migrations ./migrations
COPY ./entrypoint.sh ./entrypoint.sh

RUN chmod +x /usr/src/su/entrypoint.sh

RUN cargo build --release --target x86_64-unknown-linux-musl

# Stage 2: Create the runnable image using the statically-linked binary
FROM scratch as runner
FROM debian:latest

# Update package index and install aws-cli
RUN apt-get update && \
apt-get install -y awscli && \
apt-get clean

# Set the working directory in the container
WORKDIR /app

# Copy the statically-linked binary from your local file system to the container
COPY --from=builder /usr/src/su/target/x86_64-unknown-linux-musl/release/su /app/su
COPY --from=builder /usr/src/su/entrypoint.sh /app/entrypoint.sh

# Provide instructions for building the binary
# (This will be displayed when someone runs `docker build`)
LABEL build_instructions="To build just the binary, run the following command: docker build --target builder -t su ."

# Run the binary - provide args on execution
ENTRYPOINT [ "/app/su" ]
ENTRYPOINT [ "./app/entrypoint.sh" ]
9 changes: 9 additions & 0 deletions servers/su/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash

# make a wallet.json file from secrets-manager
aws secretsmanager get-secret-value --secret-id ao-wallet --query SecretString --output text > wallet.json

# make a .env file
echo "SU_WALLET_PATH=wallet.json" >> .env

exec ./su $1

0 comments on commit 61ee002

Please sign in to comment.