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

Use s3cmd

parent f0d3bcaa
No related branches found
No related tags found
1 merge request!1MVP
Pipeline #1824 failed
This commit is part of merge request !1. Comments created here will be created in the context of that merge request.
...@@ -7,7 +7,7 @@ RUN echo "deb http://security.debian.org/ buster/updates main" >> /etc/apt/sourc ...@@ -7,7 +7,7 @@ RUN echo "deb http://security.debian.org/ buster/updates main" >> /etc/apt/sourc
RUN apt-get update \ RUN apt-get update \
&& apt-get -y --no-install-recommends install \ && apt-get -y --no-install-recommends install \
s4cmd \ s3cmd \
&& apt-get clean \ && apt-get clean \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
......
...@@ -6,7 +6,7 @@ export BUCKET_NAME ...@@ -6,7 +6,7 @@ export BUCKET_NAME
EXPIRE_AGE_DAYS=$(cat /s3_expire_days) EXPIRE_AGE_DAYS=$(cat /s3_expire_days)
export EXPIRE_AGE_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 do
createDate=$(echo "$line"|awk '{print $1" "$2}') createDate=$(echo "$line"|awk '{print $1" "$2}')
createDate=$(date -d"$createDate" +%s) createDate=$(date -d"$createDate" +%s)
...@@ -17,7 +17,7 @@ s4cmd --config=/s3_config ls s3://"${BUCKET_NAME}" | while read -r line; ...@@ -17,7 +17,7 @@ s4cmd --config=/s3_config ls s3://"${BUCKET_NAME}" | while read -r line;
echo "$fileName" echo "$fileName"
if [[ $fileName != "" ]] if [[ $fileName != "" ]]
then then
s4cmd --config=/s3_config del "$fileName" s3cmd --config=/s3_config del "$fileName"
fi fi
fi fi
done; done;
...@@ -3,7 +3,14 @@ services: ...@@ -3,7 +3,14 @@ services:
s3_object_expirer: s3_object_expirer:
image: containers.ethitter.com:443/docker/s3-object-expirer:latest image: containers.ethitter.com:443/docker/s3-object-expirer:latest
restart: unless-stopped 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: s3_config:
file: ./config/.s3cfg file: ./config/.s3cfg
s3_bucket: s3_bucket:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment