diff --git a/Dockerfile b/Dockerfile index 66661c0..c202d24 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,16 @@ # Pull base image. -FROM dtr.cucloud.net/cs/s3sync +FROM 078742956215.dkr.ecr.us-east-1.amazonaws.com/kuali/base USER root +RUN mkdir /sync +# Install python and pip +RUN \ + apt-get update && \ + apt-get install -y python python-pip jq && \ + rm -rf /var/lib/apt/lists/* + +# Install AWS CLI tools +RUN pip install awscli RUN groupadd -g 7070 tcadm RUN useradd -u 105 -g 7070 tomcat7 diff --git a/sync.rb b/sync.rb index b497b1d..fce9949 100644 --- a/sync.rb +++ b/sync.rb @@ -17,6 +17,9 @@ def up_sync puts `aws s3 sync /sync s3://#{ENV['S3_BUCKET']}` end +def dn_sync + puts `aws s3 sync s3://#{ENV['S3_BUCKET']} /sync` +end def sync start = Time.now @@ -31,10 +34,10 @@ def sync sync {up_sync} end - - if (ONCE) - break + if DIRECTION.eql?("DN") + sync {dn_sync} end + sleep SLEEP_SECONDS end