forked from MikeWent/webm2mp4
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
88 lines (76 loc) · 2.92 KB
/
Copy path.gitlab-ci.yml
File metadata and controls
88 lines (76 loc) · 2.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
stages:
- prerun_setup
- test
- build
- deploy
# Official language image. Look for the different tagged releases at:
# https://hub.docker.com/r/library/python/tags/
image: python:latest
# Change pip's cache directory to be inside the project directory since we can
# only cache local items.
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
# Pip's cache doesn't store the python packages
# https://pip.pypa.io/en/stable/reference/pip_install/#caching
#
# If you want to also cache the installed packages, you have to install
# them in a virtualenv and cache it as well.
cache:
paths:
- .cache/pip
- venv/
before_script:
# - apt-get update
# - apt-get install -y ffmpeg
- python -V # Print out python version for debugging
- pip3 install virtualenv
- virtualenv venv
- source venv/bin/activate
Setup_Requirements:
stage: prerun_setup
script:
- echo "PreRun Setup"
- source venv/bin/activate
- pip3 install -r requirements.txt
Code_Runner:
stage: test
script:
- source venv/bin/activate
- ./bot.py
Docker_Image_Builder:
before_script:
- ''
stage: build
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script:
- mkdir -p /kaniko/.docker
- 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:$CI_COMMIT_TAG --destination $CI_REGISTRY_IMAGE:latest
rules:
- if: $CI_COMMIT_TAG
deploy-prod:
# only:
# - pushes
stage: deploy
before_script:
# Adding environment's variable SSH_PRIVATE_KEY to the SSH client's agent that manages the private keys
- apt install openssh-client # Add SSH client for alpine
- eval $(ssh-agent -s) # Run the SSH client
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
# Create the SSH directory and give it the right permissions
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
script:
# -o StrictHostKeyCheking=no is to disable strict host key checking in SSH
# Making ENV TELEGRAM_TOKEN2 available on Remote host
- LC_TELEGRAM_TOKEN2=$TELEGRAM_TOKEN2
- ssh -o StrictHostKeyChecking=no $SERVER_USER@$SERVER_IP "TELEGRAM_TOKEN2=$LC_TELEGRAM_TOKEN2"
# Connecting to the server using SSH and changing dir
# - ssh -o StrictHostKeyChecking=no $SERVER_USER@$SERVER_IP "cd /home/$SERVER_USER/docker/services/telegram/kala2xBot"
- ssh -o StrictHostKeyChecking=no $SERVER_USER@$SERVER_IP "docker pull registry.seedelmann.ch/kalabint/webm2mp4:latest"
- ssh -o StrictHostKeyChecking=no $SERVER_USER@$SERVER_IP "docker container rm -f kala2xBot_Docker || true"
- ssh -o StrictHostKeyChecking=no $SERVER_USER@$SERVER_IP "docker run -d -e TELEGRAM_TOKEN=$TELEGRAM_TOKEN2 --name kala2xBot_Docker registry.seedelmann.ch/kalabint/webm2mp4:latest"
rules:
- if: $CI_COMMIT_TAG