Added MinIO

This commit is contained in:
2023-04-27 23:18:14 -07:00
parent 0e2ef14a5a
commit a02e1dc69b
15 changed files with 212 additions and 101 deletions

7
minio/mc/Dockerfile Normal file
View File

@@ -0,0 +1,7 @@
# Container image that runs your code
FROM minio/mc:RELEASE.2023-01-11T03-14-16Z
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

39
minio/mc/action.yaml Normal file
View File

@@ -0,0 +1,39 @@
name: mc
description: "Run MinIO Client mc commands."
inputs:
args:
description: "Arguments to pass into mc."
required: true
alias:
description: "S3 alias."
required: true
default: s3
url:
description: "S3 URL."
required: true
default: https://s3-us-gov-west-1.amazonaws.com
accessKey:
description: "S3 access key."
required: true
secretKey:
description: "S3 secret key."
required: true
catchErrors:
description: "Whether or not errors should be handled."
required: false
outputs:
console:
description: "The console output of the aws command."
exitCode:
description: "How the program exited."
runs:
using: docker
image: Dockerfile
env:
CATCH_ERRORS: ${{ inputs.catchErrors }}
S3_URL: ${{ inputs.url }}
S3_ALIAS: ${{ inputs.alias }}
S3_ACCESS_KEY_ID: ${{ inputs.accessKey }}
S3_SECRET_ACCESS_KEY: ${{ inputs.secretKey }}
args:
- ${{ inputs.args }}

25
minio/mc/entrypoint.sh Normal file
View File

@@ -0,0 +1,25 @@
#!/bin/sh
ARGS="$@"
MC_CONFIG_DIR="/root/.mc"
mkdir -p "$MC_CONFIG_DIR"
mc --config-dir "$MC_CONFIG_DIR" alias set "$S3_ALIAS" "$S3_URL" "$S3_ACCESS_KEY_ID" "$S3_SECRET_ACCESS_KEY"
OUTPUT=$(bash -c "mc --config-dir $MC_CONFIG_DIR $ARGS")
RESULT=$?
echo "$OUTPUT"
#Output multiline strings.
#https://trstringer.com/github-actions-multiline-strings/
if [[ -n "$OUTPUT" ]]; then
echo "console<<EOF" >> "$GITHUB_OUTPUT"
echo "$OUTPUT" >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
fi
echo "exitCode=$RESULT" >> "$GITHUB_OUTPUT"
if [[ "$CATCH_ERRORS" != "true" ]]; then
exit $RESULT
fi