Skip to content
Snippets Groups Projects
Verified Commit 4410c570 authored by Tilman Vatteroth's avatar Tilman Vatteroth :robot:
Browse files

ready for docker!

parent 62b6755a
Branches
No related tags found
No related merge requests found
stages:
- build
docker:
stage: build
before_script: []
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script:
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:latest
FROM python:3-alpine
RUN apk upgrade --available --update
WORKDIR /usr/src/app
COPY requirements.txt ./
RUN apk add --no-cache build-base && \
pip install --no-cache-dir -r requirements.txt && \
apk del build-base
COPY src .
COPY run.sh /usr/local/bin/run.sh
COPY crontab /var/spool/cron/crontabs/programbot
RUN chmod +x /usr/local/bin/run.sh
RUN apk add --no-cache msmtp
CMD ["crond", "-f"]
* 9 * * * /usr/local/bin/run.sh >/dev/null 2>&1
run.sh 0 → 100755
#!/bin/bash
cd /usr/src/app
function preview {
(>&2 echo "run twitter")
python3 twitter_bot.py --nofailmessage --daydiff 2
echo ""
(>&2 echo "run telegram")
python3 telegram_bot.py --nofailmessage --daydiff 2
echo ""
(>&2 echo "run twitter as doit")
python3 twitter_bot.py --nofailmessage --daydiff 1 --doit
echo ""
(>&2 echo "run telegram as doit")
python3 telegram_bot.py --nofailmessage --daydiff 1 --doit
echo ""
}
OUTPUT="$(preview)"
if [ ! -z "$OUTPUT" ]
then
echo "$OUTPUT" | msmtp -a "Content-Type: text/plain; charset=UTF-8" ${MSMTP_ARGUMENTS}
fi
File moved
File moved
File moved
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment