Skip to content

Commit

Permalink
Created s3-uploader script
Browse files Browse the repository at this point in the history
  • Loading branch information
kiran committed Jul 9, 2020
1 parent 99ffc60 commit c096739
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [v0.1.0] - 2020-07-09
### Added
- Initial commit
- Updated README

[Unreleased]: https://github.com/PaytmLabs/docker-custom-aws-cli/compare/v0.1.0...HEAD
[v0.1.0]: https://github.com/PaytmLabs/docker-custom-aws-cli/releases/tag/v0.1.0
Expand Down
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ RUN rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.
yum update -y && \
yum install -y inotify-tools jq

ENTRYPOINT /bin/sh
COPY s3-uploader.sh s3-uploader.sh

ENTRYPOINT ["./s3-uploader.sh"]
12 changes: 12 additions & 0 deletions s3-uploader.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/bash
set -euo pipefail

SOURCE_DIR="$1"
S3_PATH="$2"
timestamp=$(date "+%s")
inotifywait -m /"$SOURCE_DIR" -e close_write | \
while read -r path action file; do
echo "$path$file is detected"
aws s3 cp "$path$file" "$S3_PATH"/"$file"_"$timestamp"
rm "$path$file"
done

0 comments on commit c096739

Please sign in to comment.