ci: dockerize setup

This commit is contained in:
Dominik Siebel 2024-09-16 11:48:20 +02:00 committed by Daniel Molkentin
parent c7f725adb8
commit e4f0eedded
7 changed files with 87 additions and 10 deletions

14
.dockerignore Normal file
View File

@ -0,0 +1,14 @@
.git
.github
eos-data/
mariadb-data/
test_data/
.dockerignore
.env
.gitignore
docker-compose.yaml
Dockerfile
LICENSE
Makefile
NOTICE
README.md

3
.env Normal file
View File

@ -0,0 +1,3 @@
EOS_VERSION=latest
MARIADB_VERSION=11.1.6
PYTHON_VERSION=3.12.6

2
.gitignore vendored
View File

@ -1,2 +1,4 @@
.venv
docs
eos-data/
mariadb-data/

25
Dockerfile Normal file
View File

@ -0,0 +1,25 @@
ARG PYTHON_VERSION=3.12.6
FROM python:${PYTHON_VERSION}-slim
LABEL source="https://github.com/Akkudoktor-EOS/EOS"
ARG APT_OPTS="--yes --auto-remove --no-install-recommends --no-install-suggests"
RUN DEBIAN_FRONTEND=noninteractive \
apt-get update \
&& apt-get install ${APT_OPTS} gcc libhdf5-dev libmariadb-dev pkg-config \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /var/lib/eos
WORKDIR /opt/eos
COPY requirements.txt requirements.txt
RUN pip install --no-cache-dir --upgrade pip \
&& pip install --no-cache-dir -r requirements.txt
COPY . .
COPY config.example.py config.py
ENTRYPOINT []
CMD ["python", "flask_server.py"]

View File

@ -36,3 +36,7 @@ clean:
run:
@echo "Starting flask server, please wait..."
.venv/bin/python ./flask_server.py
# Run entire setup on docker
docker-run:
@docker-compose up

View File

@ -1,25 +1,23 @@
from datetime import datetime, timedelta
prediction_hours=48
prediction_hours=48
optimization_hours=24
strafe=10
moegliche_ladestroeme_in_prozent = [0.0 ,6.0/16.0, 7.0/16.0, 8.0/16.0, 9.0/16.0, 10.0/16.0, 11.0/16.0, 12.0/16.0, 13.0/16.0, 14.0/16.0, 15.0/16.0, 1.0 ]
# Optional
db_config = {
'user': '',
'password': '',
'host': '192.168.1.135',
'database': ''
db_config = {
'user': 'eos',
'password': 'eos',
'host': '127.0.0.1',
'database': 'eos'
}
def get_start_enddate(prediction_hours=48,startdate=None):
############
# Parameter
# Parameter
############
if startdate == None:
date = (datetime.now().date() + timedelta(hours = prediction_hours)).strftime("%Y-%m-%d")

31
docker-compose.yaml Normal file
View File

@ -0,0 +1,31 @@
---
networks:
eos:
name: 'eos'
services:
eos:
image: 'akkudoktor/eos:${EOS_VERSION}'
build:
context: .
dockerfile: 'Dockerfile'
args:
PYTHON_VERSION: '${PYTHON_VERSION}'
depends_on:
- 'mariadb'
init: true
environment: {}
networks:
- 'eos'
volumes:
- ./eos-data:/data
mariadb:
image: 'mariadb:${MARIADB_VERSION}-jammy'
environment:
MARIADB_ROOT_PASSWORD: 'root'
MARIADB_DATABASE: 'eos'
MARIADB_USER: 'eos'
MARIADB_PASSWORD: 'eos'
networks:
- 'eos'
volumes:
- ./mariadb-data:/var/lib/mysql