Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to alpine for image size #10

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 9 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
FROM debian:jessie
MAINTAINER Ilya Stepanov <[email protected]>
FROM python:3.7-alpine3.8

RUN apt-get update && \
apt-get install -y python python-pip cron && \
rm -rf /var/lib/apt/lists/*
LABEL version="0.2"
LABEL maintainer="Ilya Stepanov <[email protected]>"

RUN pip install s3cmd
COPY s3cfg start.sh sync.sh get.sh /

ADD s3cfg /root/.s3cfg

ADD start.sh /start.sh
RUN chmod +x /start.sh

ADD sync.sh /sync.sh
RUN chmod +x /sync.sh

ADD get.sh /get.sh
RUN chmod +x /get.sh
RUN pip install s3cmd \
&& mv /s3cfg /root/.s3cfg \
&& chmod +x /start.sh \
&& chmod +x /sync.sh \
&& chmod +x /get.sh

ENTRYPOINT ["/start.sh"]
CMD [""]
2 changes: 1 addition & 1 deletion get.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh

set -e

Expand Down
11 changes: 3 additions & 8 deletions start.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh

set -e

Expand All @@ -18,15 +18,10 @@ elif [[ "$1" == 'get' ]]; then
elif [[ "$1" == 'delete' ]]; then
exec /usr/local/bin/s3cmd del -r "$S3_PATH"
else
LOGFIFO='/var/log/cron.fifo'
if [[ ! -e "$LOGFIFO" ]]; then
mkfifo "$LOGFIFO"
fi
CRON_ENV="PARAMS='$PARAMS'"
CRON_ENV="$CRON_ENV\nDATA_PATH='$DATA_PATH'"
CRON_ENV="$CRON_ENV\nS3_PATH='$S3_PATH'"
echo -e "$CRON_ENV\n$CRON_SCHEDULE /sync.sh > $LOGFIFO 2>&1" | crontab -
echo -e "$CRON_ENV\n$CRON_SCHEDULE /sync.sh" | crontab -
crontab -l
cron
tail -f "$LOGFIFO"
crond -f
fi
2 changes: 1 addition & 1 deletion sync.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh

set -e

Expand Down