Skip to content

Commit

Permalink
Merge pull request #56 from gonzalezzfelipe/fix/init-image-support-fo…
Browse files Browse the repository at this point in the history
…r-offline-nodes

fix: Init image to support snapshot not found
  • Loading branch information
scarmuega authored Nov 21, 2024
2 parents a8305d4 + 2e5964b commit 4ffb0e0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
11 changes: 9 additions & 2 deletions .github/images/init/dockerfile.init
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
FROM amazon/aws-cli
RUN yum update -y && yum install -y tar gzip
COPY .github/images/init/entrypoint.sh /entrypoint.sh
RUN yum update -y && yum install -y tar gzip unzip curl

WORKDIR /var/hydra-node
RUN curl -L -O https://github.com/cardano-scaling/hydra/releases/download/0.19.0/hydra-x86_64-linux-0.19.0.zip
RUN unzip -d bin hydra-x86_64-linux-0.19.0.zip
RUN cp /var/hydra-node/bin/hydra-node /hydra-node
RUN chmod +x /hydra-node

COPY docker/entrypoint.sh /entrypoint.sh
ENTRYPOINT ["sh", "/entrypoint.sh"]
12 changes: 10 additions & 2 deletions .github/images/init/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
aws s3 cp "s3://$BUCKET/$KEY" "$DATA_DIR"
tar -xzvf "$DATA_DIR/$KEY" -C "$DATA_DIR"
#!/bin/sh
if aws s3 ls "s3://$BUCKET/$KEY" > /dev/null 2>&1; then
echo "Snapshot exists, downloading..."
aws s3 cp "s3://$BUCKET/$KEY" "$DATA_DIR"
tar -xzvf "$DATA_DIR/$KEY" -C "$DATA_DIR"
else
echo "Snapshot does not exist, generating keys..."
mkdir "$DATA_DIR/keys"
/hydra-node gen-hydra-key --output-file "$DATA_DIR/keys/hydra"
fi

0 comments on commit 4ffb0e0

Please sign in to comment.