Skip to content
Snippets Groups Projects
Commit 2782ce9b authored by Erick Hitter's avatar Erick Hitter
Browse files

Use s3cmd

parent f0d3bcaa
Branches
No related tags found
1 merge request!1MVP
Checking pipeline status
......@@ -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/*
......
......@@ -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;
......@@ -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:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment