From 2782ce9bb1f8e139fc92dd9097d03d8ca4afdeb5 Mon Sep 17 00:00:00 2001
From: Erick Hitter <git-contrib@ethitter.com>
Date: Sat, 28 Dec 2019 15:10:39 -0800
Subject: [PATCH] Use s3cmd

---
 context/Dockerfile  | 2 +-
 context/s3-purge.sh | 4 ++--
 docker-compose.yml  | 9 ++++++++-
 3 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/context/Dockerfile b/context/Dockerfile
index 0770adc..c6a8d54 100644
--- a/context/Dockerfile
+++ b/context/Dockerfile
@@ -7,7 +7,7 @@ RUN echo "deb http://security.debian.org/ buster/updates main" >> /etc/apt/sourc
 
 RUN apt-get update \
     && apt-get -y --no-install-recommends install \
-        s4cmd \
+        s3cmd \
     && apt-get clean \
     && rm -rf /var/lib/apt/lists/*
 
diff --git a/context/s3-purge.sh b/context/s3-purge.sh
index 425d5cb..005a77a 100755
--- a/context/s3-purge.sh
+++ b/context/s3-purge.sh
@@ -6,7 +6,7 @@ export BUCKET_NAME
 EXPIRE_AGE_DAYS=$(cat /s3_expire_days)
 export EXPIRE_AGE_DAYS
 
-s4cmd --config=/s3_config ls s3://"${BUCKET_NAME}" | while read -r line;
+s3cmd --config=/s3_config ls s3://"${BUCKET_NAME}" | while read -r line;
   do
     createDate=$(echo "$line"|awk '{print $1" "$2}')
     createDate=$(date -d"$createDate" +%s)
@@ -17,7 +17,7 @@ s4cmd --config=/s3_config ls s3://"${BUCKET_NAME}" | while read -r line;
         echo "$fileName"
         if [[ $fileName != "" ]]
           then
-            s4cmd --config=/s3_config del "$fileName"
+            s3cmd --config=/s3_config del "$fileName"
         fi
     fi
   done;
diff --git a/docker-compose.yml b/docker-compose.yml
index 8be0de6..ff351a0 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -3,7 +3,14 @@ services:
   s3_object_expirer:
     image: containers.ethitter.com:443/docker/s3-object-expirer:latest
     restart: unless-stopped
-configs:
+    secrets:
+      - source: s3_config
+        target: /s3_config
+      - source: s3_bucket
+        target: /s3_bucket
+      - source: s3_expire_days
+        target: /s3_expire_days
+secrets:
   s3_config:
     file: ./config/.s3cfg
   s3_bucket:
-- 
GitLab