diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..12ea4f0 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM alpine +MAINTAINER Shamil Ganiev + +WORKDIR /srv + +COPY cmd.sh /usr/bin + +RUN apk add --no-cache optipng bash git \ + && echo 'PS1="\[\e[1;32m\][\u@\h \[\e[1;34m\]\W \[\e[1;32m\]]\[\033[00m\] "' > /root/.bashrc + +CMD [ "cmd.sh" ] diff --git a/cmd.sh b/cmd.sh new file mode 100755 index 0000000..c9483e2 --- /dev/null +++ b/cmd.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +modified_files=`git diff --cached --name-only | grep .png` +current_dir=`pwd` +echo $modified_files +if [ -z "$modified_files" ];then + exit 0 +else + for i in ${modified_files}; do optipng -o7 -quiet ${i}; done +fi +