Commit 688612c1 authored by Fabio Montefuscolo's avatar Fabio Montefuscolo
Browse files

Added awscli to cron image

parent c8f4fa97
Pipeline #2745 passed with stage
in 52 seconds
---
image: docker:git
services:
- docker:dind
stages:
- build
- deploy
variables:
IMAGE_TAGGED: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
IMAGE_LATEST: $CI_REGISTRY_IMAGE:lastest
build:
stage: build
script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN hub.hacklab.com.br
- docker build -t $IMAGE_TAGGED .
- docker tag $IMAGE_TAGGED $IMAGE_LATEST
- docker push $IMAGE_TAGGED
- docker push $IMAGE_LATEST
only:
- tags
- /master/
tags:
- docker:dind
......@@ -2,10 +2,12 @@ FROM alpine:latest
MAINTAINER Fabio Montefuscolo <fabio.montefuscolo@gmail.com>
RUN apk update && \
apk add dcron && \
rm -rf /var/cache/apk/*
apk add dcron python py2-pip && \
rm -rf /var/cache/apk/* && \
pip install awscli && \
mkdir /root/.aws
VOLUME /etc/periodic
VOLUME ["/etc/periodic", "/root/.aws"]
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
......
......@@ -8,6 +8,39 @@ mkdir -p /etc/periodic/daily
mkdir -p /etc/periodic/weekly
mkdir -p /etc/periodic/monthly
if [ -n "$BASE64_AWS_TARGZ_DIR" ];
then
echo "$BASE64_AWS_TARGZ_DIR" \
| base64 -d \
| tar -C /root -zxvf -;
fi
[ -n "$SCRIPT_15MIN" ] \
&& echo -e "#/bin/sh\n$SCRIPT_15MIN" \
> /etc/periodic/15min/oneline_script.sh
[ -n "$SCRIPT_HOURLY" ] \
&& echo -e "#/bin/sh\n$SCRIPT_HOURLY" \
> /etc/periodic/hourly/oneline_script.sh
[ -n "$SCRIPT_DAILY" ] \
&& echo -e "#/bin/sh\n$SCRIPT_DAILY" \
> /etc/periodic/daily/oneline_script.sh
[ -n "$SCRIPT_WEEKLY" ] \
&& echo -e "#/bin/sh\n$SCRIPT_WEEKLY" \
> /etc/periodic/weekly/oneline_script.sh
[ -n "$SCRIPT_MONTHLY" ] \
&& echo -e "#/bin/sh\n$SCRIPT_MONTHLY" \
> /etc/periodic/monthly/oneline_script.sh
find /etc/periodic \
-mindepth 2 \
-maxdepth 2 \
-type f -name "*.sh" \
-exec chmod 755 {} \;
stop() {
echo "Received SIGINT or SIGTERM. Shutting down $DAEMON"
pid=$(cat /var/run/$DAEMON/$DAEMON.pid)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment