diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..2be6a3e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,18 @@ +# syntax=docker/dockerfile:1 + +FROM python:3.8-slim-buster + +WORKDIR /app + +COPY REQUIREMENTS REQUIREMENTS +RUN pip3 install -r REQUIREMENTS + +COPY bin bin +COPY etc /etc +COPY lib lib +COPY docker/entrypoint.sh entrypoint.sh + +RUN mkdir /app/config +RUN chmod u+x entrypoint.sh + +ENTRYPOINT ["/app/entrypoint.sh"] \ No newline at end of file diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100644 index 0000000..5deb1c7 --- /dev/null +++ b/docker/docker-compose.yml @@ -0,0 +1,16 @@ +version: "3" +services: + server: + container_name: cpe-guesser + image: cpe-guesser:1.0 + build: .. + volumes: + - ../data/:/data/:rw + - ./settings.yaml:/app/config/settings.yaml + ports: + - 8000:8000 + depends_on: + - redis + redis: + container_name: cpe-guesser-db + image: "redis:alpine" \ No newline at end of file diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh new file mode 100644 index 0000000..9b476b0 --- /dev/null +++ b/docker/entrypoint.sh @@ -0,0 +1,5 @@ +#!/bin/bash +set -e + +python3 -u /app/bin/import.py +python3 -u /app/bin/server.py \ No newline at end of file diff --git a/docker/settings.yaml b/docker/settings.yaml new file mode 100644 index 0000000..64eb959 --- /dev/null +++ b/docker/settings.yaml @@ -0,0 +1,8 @@ +server: + port: 8000 +redis: + host: redis + port: 6379 +cpe: + path: '/data/official-cpe-dictionary_v2.3.xml' + source: 'https://nvd.nist.gov/feeds/xml/cpe/dictionary/official-cpe-dictionary_v2.3.xml.gz' \ No newline at end of file