ci, docker, config stuff
This commit is contained in:
parent
9e51c25eab
commit
f45a18f23c
37
.gitlab-ci.yml
Normal file
37
.gitlab-ci.yml
Normal file
@ -0,0 +1,37 @@
|
||||
stages:
|
||||
- check
|
||||
- build
|
||||
|
||||
variables:
|
||||
IMAGE_NAME: $CI_REGISTRY/$CI_PROJECT_PATH
|
||||
|
||||
check:
|
||||
image: registry.hottis.de/dockerized/base-build-env:latest
|
||||
stage: check
|
||||
tags:
|
||||
- hottis
|
||||
- linux
|
||||
- docker
|
||||
rules:
|
||||
- if: $CI_COMMIT_TAG
|
||||
script:
|
||||
- checksemver.py -v
|
||||
--versionToValidate "${CI_COMMIT_TAG}"
|
||||
--validateMessage
|
||||
--messageToValidate "${CI_COMMIT_MESSAGE}"
|
||||
|
||||
build:
|
||||
image: registry.hottis.de/dockerized/docker-bash:latest
|
||||
stage: build
|
||||
tags:
|
||||
- hottis
|
||||
- linux
|
||||
- docker
|
||||
script:
|
||||
- docker build --tag $IMAGE_NAME:latest .
|
||||
- if [ "$CI_COMMIT_TAG" != "" ]; then
|
||||
docker tag $IMAGE_NAME:latest $IMAGE_NAME:${CI_COMMIT_TAG};
|
||||
docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY;
|
||||
docker push $IMAGE_NAME:latest;
|
||||
docker push $IMAGE_NAME:${CI_COMMIT_TAG};
|
||||
fi
|
30
Dockerfile
Normal file
30
Dockerfile
Normal file
@ -0,0 +1,30 @@
|
||||
FROM python:latest
|
||||
|
||||
LABEL Maintainer="Wolfgang Hottgenroth wolfgang.hottgenroth@icloud.com"
|
||||
LABEL ImageName="registry.hottis.de/wolutator/digitaltwin1"
|
||||
|
||||
ARG APP_DIR="/opt/app"
|
||||
ARG CONF_DIR="${APP_DIR}/config"
|
||||
|
||||
|
||||
|
||||
RUN \
|
||||
apt update && \
|
||||
pip3 install loguru && \
|
||||
pip3 install pymodbus
|
||||
|
||||
RUN \
|
||||
mkdir -p ${APP_DIR} && \
|
||||
mkdir -p ${CONF_DIR} && \
|
||||
useradd -d ${APP_DIR} -u 1000 user
|
||||
|
||||
COPY src/*.py ${APP_DIR}/
|
||||
COPY config.ini ${CONF_DIR}/
|
||||
|
||||
USER 1000:1000
|
||||
WORKDIR ${APP_DIR}
|
||||
VOLUME ${CONF_DIR}
|
||||
|
||||
|
||||
CMD "python digitaltwin1.py -f ./config/config.ini"
|
||||
|
11
config.ini
Normal file
11
config.ini
Normal file
@ -0,0 +1,11 @@
|
||||
[modbus]
|
||||
client = 172.16.2.157
|
||||
scanrate = 0.25
|
||||
|
||||
[mqtt]
|
||||
broker = 172.16.2.16
|
||||
digitalOutputTopicPrefix = dt1/coil
|
||||
digitalInputTopicPrefix = dt1/di
|
||||
analogInputEventTopicPrefix = dt1/ai/event
|
||||
analogInputPeriodicTopicPrefix = dt1/ai/periodic
|
||||
analogInputPublishPeriod = 10.0
|
Loading…
x
Reference in New Issue
Block a user