Automazione build e deploy
This commit is contained in:
15
docker/build.sh
Executable file
15
docker/build.sh
Executable file
@@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
GIT_HASH=$(git rev-parse --short HEAD)
|
||||||
|
|
||||||
|
echo "Building UPSmon"
|
||||||
|
cp ../pyutils/utils.py ../upsmon/
|
||||||
|
docker build --build-arg BUILD_VER=${GIT_HASH} -f ../upsmon/upsmon.Dockerfile -t upsmon:influx3 ../upsmon
|
||||||
|
rm ../upsmon/utils.py
|
||||||
|
|
||||||
|
echo "Building Routermon"
|
||||||
|
cp ../pyutils/utils.py ../routermon/
|
||||||
|
docker build --build-arg BUILD_VER=${GIT_HASH} -f ../routermon/routermon.Dockerfile -t routermon:influx3 ../routermon
|
||||||
|
rm ../routermon/utils.py
|
||||||
|
|
||||||
|
docker-compose up -d
|
||||||
@@ -1,9 +1,12 @@
|
|||||||
FROM python:3.12-alpine
|
FROM python:3.12-alpine
|
||||||
|
ARG BUILD_VER
|
||||||
|
|
||||||
RUN apk update && apk upgrade --no-cache
|
RUN apk update && apk upgrade --no-cache
|
||||||
|
|
||||||
RUN pip install --no-cache-dir RouterOS-API influxdb3-python
|
RUN pip install --no-cache-dir RouterOS-API influxdb3-python
|
||||||
|
|
||||||
COPY ./routermon.py /home/routermon.py
|
COPY ./routermon.py /home/routermon.py
|
||||||
|
COPY ./utils.py /home/pyutils/utils.py
|
||||||
|
|
||||||
|
ENV VER=${BUILD_VER}
|
||||||
CMD [ "python", "/home/routermon.py" ]
|
CMD [ "python", "/home/routermon.py" ]
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
FROM python:3.12-alpine
|
FROM python:3.12-alpine
|
||||||
|
ARG BUILD_VER
|
||||||
|
|
||||||
RUN apk update && apk upgrade --no-cache
|
RUN apk update && apk upgrade --no-cache
|
||||||
|
|
||||||
RUN pip install --no-cache-dir pyserial RouterOS-API influxdb3-python
|
RUN pip install --no-cache-dir pyserial RouterOS-API influxdb3-python
|
||||||
|
|
||||||
COPY ./ups.py /home/ups.py
|
COPY ./ups.py /home/ups.py
|
||||||
|
COPY ./utils.py /home/pyutils/utils.py
|
||||||
|
|
||||||
|
ENV VER=${BUILD_VER}
|
||||||
CMD [ "python", "/home/ups.py" ]
|
CMD [ "python", "/home/ups.py" ]
|
||||||
|
|||||||
Reference in New Issue
Block a user