From 2b4e037b51c2e66b71e918fcf46b06f123918301 Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Thu, 28 Jul 2022 19:21:08 +0100 Subject: [PATCH] Add docker definitions --- Dockerfile | 18 ++++++++++++++++++ docker-compose.yml | 34 ++++++++++++++++++++++++++++++++++ docker/redis.conf | 2 ++ requirements.txt | 1 + 4 files changed, 55 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml create mode 100644 docker/redis.conf diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..6c63843 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,18 @@ +# syntax=docker/dockerfile:1 +FROM python:3 + +RUN useradd -d /code pathogen +RUN mkdir /code +RUN chown pathogen:pathogen /code + +RUN mkdir /venv +RUN chown pathogen:pathogen /venv + +USER pathogen +ENV PYTHONDONTWRITEBYTECODE=1 +ENV PYTHONUNBUFFERED=1 +WORKDIR /code +COPY requirements.txt /code/ +RUN python -m venv /venv +RUN . /venv/bin/activate && pip install -r requirements.txt +CMD . /venv/bin/activate && exec python /code/threshold \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..ec514e4 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,34 @@ +version: "3.9" + +services: + app: + image: pathogen/threshold + build: . + volumes: + - .:/code + ports: + - "13867:13867" + - "13868:13868" + - "13869:13869" + # for development + extra_hosts: + - "host.docker.internal:host-gateway" + + tmp: + image: busybox + command: chmod -R 777 /var/run/redis + volumes: + - /var/run/redis + + redis: + image: redis + command: redis-server /etc/redis.conf + volumes: + - ./docker/redis.conf:/etc/redis.conf + volumes_from: + - tmp + +networks: + default: + external: + name: pathogen \ No newline at end of file diff --git a/docker/redis.conf b/docker/redis.conf new file mode 100644 index 0000000..46366bf --- /dev/null +++ b/docker/redis.conf @@ -0,0 +1,2 @@ +unixsocket /var/run/redis/redis.sock +unixsocketperm 777 \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 8d6b25a..375a8eb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,3 +6,4 @@ pyYaML python-logstash service_identity csiphash +Klein