add mongo backup

main
ycz008 2024-07-29 19:08:15 +08:00
parent c75da3c383
commit 2bf380260c
2 changed files with 5 additions and 1 deletions

View File

@ -10,7 +10,7 @@ RUN apt update && apt install -y curl unzip && \
tar xf mongodump.tgz -C /usr/local && \ tar xf mongodump.tgz -C /usr/local && \
rm -rf aws awscliv2.zip mongodump.tgz rm -rf aws awscliv2.zip mongodump.tgz
ENV PATH=$PATH:/usr/local/mongodump/bin DATABASES="" HOST="" PORT="" PASSWORD="" ENV PATH=$PATH:/usr/local/mongodump/bin DATABASES="" HOST="" PORT="" PASSWORD="" AWS_ACCESS_KEY="" AWS_SECRET_KEY=""
COPY entrypoint.sh /usr/local/bin COPY entrypoint.sh /usr/local/bin
CMD [ "/usr/local/bin/entrypoint.sh" ] CMD [ "/usr/local/bin/entrypoint.sh" ]

View File

@ -2,6 +2,10 @@
datetime=`date +%Y%m%d%H` datetime=`date +%Y%m%d%H`
mkdir -p ~/.aws
echo -ne "[default]\naws_access_key_id = ${AWS_ACCESS_KEY}\naws_secret_access_key = ${AWS_SECRET_KEY}\n" > ~/.aws/credentials
dbs=($DATABASES) dbs=($DATABASES)
for db in "${dbs[@]}" for db in "${dbs[@]}"