You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

45 lines
1.1 KiB

kind: pipeline
type: docker
name: build-and-run-python
trigger:
branch:
include:
- master
event:
include:
- push
- custom
- merge_request
steps:
- name: build python image
image: docker
volumes:
- name: dockersock
path: /var/run/docker.sock
commands:
- docker build --no-cache -t alert-python:latest -f Dockerfile .
- name: run python container
image: docker
volumes:
- name: dockersock
path: /var/run/docker.sock
- name: python-conf
path: /opt/alert/model-lab
commands:
- mkdir -p /opt/alert/model-lab
- cp config.py /opt/alert/model-lab/config.py
- docker stop alert-python || true
- docker rm alert-python || true
- docker run -d --restart always --name alert-python --network alert-net -p 8082:8082 -v /opt/alert/model-lab/config.py:/opt/alert/model-lab/config.py:ro alert-python:latest
volumes:
- name: dockersock
host:
path: /var/run/docker.sock
- name: python-conf
host:
path: /opt/alert/model-lab