From b59a6368c9919fe9ff488c4bae20d530a769241b Mon Sep 17 00:00:00 2001 From: Simon Rieger Date: Fri, 20 Oct 2023 19:59:19 +0200 Subject: [PATCH] add Dockerfile and docker-compose.yml with environmets --- .env.example | 6 ++++++ Dockerfile | 22 ++++++++++++++++++++++ docker-compose.yml | 20 ++++++++++++++++++++ 3 files changed, 48 insertions(+) create mode 100644 .env.example create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..f57d1f6 --- /dev/null +++ b/.env.example @@ -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 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d69eeb1 --- /dev/null +++ b/Dockerfile @@ -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"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..7cf3f61 --- /dev/null +++ b/docker-compose.yml @@ -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