-
Notifications
You must be signed in to change notification settings - Fork 0
/
solar-logger.dockerfile
58 lines (55 loc) · 2.05 KB
/
solar-logger.dockerfile
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
FROM python:3.10.2 as builder
ARG BASE_DIR="solarlogger"
WORKDIR ${BASE_DIR}
# Run updates
RUN apt-get update && pip install --upgrade pip
ADD requirements.txt requirements.txt
RUN pip install -r requirements.txt
# /config -> /solarlogger/config
ADD src/config/config.ini src/config/config.ini
FROM builder as solar-logger
ARG BASE_DIR
ADD start_logger.py start_logger.py
# /app -> /solarlogger/app
ADD src/app/solar_main.py src/app/solar_main.py
# /classes -> /solarlogger/classes
ADD src/classes/common_classes.py src/classes/common_classes.py
ADD src/classes/custom_exceptions.py src/classes/custom_exceptions.py
ADD src/classes/influx_classes.py src/classes/influx_classes.py
ADD src/classes/mqtt_classes.py src/classes/mqtt_classes.py
# /helpers -> /solarlogger/helpers
ADD src/helpers/consts.py src/helpers/consts.py
ADD src/helpers/py_functions.py src/helpers/py_functions.py
ADD src/helpers/py_logger.py src/helpers/py_logger.py
# Run instance
CMD [ "python", "start_logger.py" ]
FROM builder as influx-query
ARG BASE_DIR
# Add required modules
ADD start_query.py start_query.py
# /app -> /solarlogger/app
ADD src/app/influx_query.py src/app/influx_query.py
# /classes -> /solarlogger/classes
ADD src/classes/common_classes.py src/classes/common_classes.py
ADD src/classes/custom_exceptions.py src/classes/custom_exceptions.py
ADD src/classes/influx_classes.py src/classes/influx_classes.py
ADD src/classes/query_classes.py src/classes/query_classes.py
# /helpers -> /solarlogger/helpers
ADD src/helpers/consts.py src/helpers/consts.py
ADD src/helpers/py_functions.py src/helpers/py_functions.py
ADD src/helpers/py_logger.py src/helpers/py_logger.py
# Run instance
CMD [ "python", "-i", "start_query.py"]
FROM python:3.10.2 as unit-tests
ARG BASE_DIR="solar_logger"
WORKDIR /solarlogger/
# Run updates
RUN apt-get update && pip install --upgrade pip
ADD requirements.txt requirements.txt
ADD requirements-test.txt requirements-test.txt
RUN pip install -r requirements-test.txt
ADD src/ src/
ADD tests/ tests/
ADD pyproject.toml pyproject.toml
# Run instance
CMD [ "python", "-m", "pytest"]