add Dockerfile and docker-compose.yml with environmets

This commit is contained in:
Simon Rieger 2023-10-20 19:59:19 +02:00
parent d56f8dba6d
commit b59a6368c9
3 changed files with 48 additions and 0 deletions

6
.env.example Normal file
View file

@ -0,0 +1,6 @@
CHECK_FREQUENCY_SECONDS: default value for --check-frequency-seconds param
OPNSENSE_MAIN_HOST: default value for --main-host param
OPNSENSE_BACKUP_HOST: default value for --backup-host param
OPNSENSE_USERNAME: default value for --opnsense-user param
OPNSENSE_PASSWORD: default value for --opnsense-password param
OPNSENSE_INTERFACES: default value for --opnsense-interfaces param

22
Dockerfile Normal file
View file

@ -0,0 +1,22 @@
FROM python:latest
#WORKDIR /usr/app/src
# Install package
WORKDIR /code
COPY . .
#COPY prometheus-ssh-exporter.py ./
#COPY requirements.txt ./
RUN pip3 install -r requirements.txt
RUN python -u setup.py install
# Set this to the port you want to expose
EXPOSE 8000
# Set the -p option to the port you exposed above, defaults to 8000
#CMD ["python", "-u", "opnsense-exporter"]
#CMD ["sleep", "60"]
CMD ["opnsense-exporter"]

20
docker-compose.yml Normal file
View file

@ -0,0 +1,20 @@
version: '3.4'
services:
opnsense-exporter:
image: opnsense-exporter
build:
context: .
dockerfile: ./Dockerfile
restart: always
container_name: opnsense-exporter
#network_mode: "host"
ports:
- 8000:8000
env_file:
- .env
logging:
driver: "json-file"
options:
max-file: "3"
max-size: 10m