Example docker job to upload and download Polly files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# In this example the docker is being built with docker name "mithoopolly/polly_cli_test" and tag "latest" | |
FROM ubuntu:latest | |
# update the node and npm | |
RUN apt-get update && \ | |
apt-get install -y \ | |
curl \ | |
git \ | |
uuid-runtime \ | |
&& \ | |
curl -sL https://deb.nodesource.com/setup_10.x | bash - && \ | |
apt-get install -y nodejs | |
# Install PollyCLI | |
RUN npm install -g @elucidatainc/pollycli && polly version --version | |
# An example script to upload and download files using Polly CLI | |
COPY entrypoint.sh /entrypoint.sh | |
RUN chmod +x /entrypoint.sh | |
CMD ["/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Checking the version of Polly CLI | |
polly --version | |
# login into Polly with Polly CLI inside a Polly job | |
polly login --auto | |
# Workspace in which job is been run will be auto detected if --yes flag is passed in the Polly jobs. | |
# If --yes is not passed it will prompt the user asking if they should take the default value | |
# or they want to enter a new value. | |
# NOTE: In the polly if --yes flag the Polly job will go to error state | |
echo "====================LISTING WORKSPACE FILES===============================" | |
polly files list --workspace-path polly:// --yes | |
echo "==========================================================================" | |
# PROJECT1_PATH is a system environment that is been passed by the user when starting a Polly job. | |
# See the Polly CLI documentation to know how to pass the environment to a job. | |
mkdir ./${PROJECT1_PATH} | |
echo "=====================DOWNLOAD THE FILES===================================" | |
polly files sync --source polly://${PROJECT1_PATH}/ --destination ./${PROJECT1_PATH} --yes | |
echo "==========================================================================" | |
echo "=====================LIST THE DOWNLOADED FILE=============================" | |
ls ./${PROJECT1_PATH} | |
echo "==========================================================================" | |
echo "====================CREATE RANDOM FILE WHICH SIMULATE OUTPUT==============" | |
RANDOM_NAME=$(uuidgen).txt | |
dd if=/dev/urandom of=${RANDOM_NAME} bs=64M count=8 | |
echo ${RANDOM_NAME} | |
echo "==========================================================================" | |
# In the below example we have used "polly files copy" to transfer a file to polly. | |
# If a group of files are there its better to use the "polly files sync" to upload | |
# the output folder. | |
echo "=====================UPLOAD THE FILES===================================" | |
polly files copy --source ./${RANDOM_NAME} --destination polly://${PROJECT1_PATH}/output/${RANDOM_NAME} --yes | |
echo "==========================================================================" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cpu": "1", | |
"memory": "1Gi", | |
"image": "mithoopolly/polly_cli_test", | |
"tag": "latest", | |
"name": "test for auto login into polly", | |
"env": { | |
"PROJECT1_PATH" : "exampleProject" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment