1
0
Fork 0
mirror of https://gitlab.jonasled.de/jonasled/discordbot synced 2024-11-20 10:13:03 +01:00

add gitlab ci

This commit is contained in:
Jonas Leder 2020-04-02 19:27:37 +02:00
parent a77d0d6697
commit 7329bdeeb5

32
.gitlab-ci.yml Normal file
View file

@ -0,0 +1,32 @@
image: docker
services:
- docker:dind
stages:
- build
- deploy
build:
stage: build
only:
- master
script:
- echo "building branch $CI_COMMIT_REF_NAME, Version $version"
- git config --global user.name "build"
- git config --global user.email "noreply@jonasled.de"
- sudo docker images prune -f
- sudo docker pull python:3
- sudo docker build -t gitlab.jonasled.de/jonasled/discordbot
- sudo docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- sudo docker push gitlab.jonasled.de/jonasled/discordbot
deploy:
stage: deploy
only:
- master
script:
- sudo apt-get install -y python-pip #install pip, this is needed to install docker-compose in the next step
- sudo pip install docker-compose #Install docker-compose with pip
- sudo docker-compose up -d #Start the new container
environment: master