Add Docker & docker-compose

This commit is contained in:
Sébastien Copin 2023-07-08 20:51:16 +02:00
parent b138364323
commit cd17ad6434
4 changed files with 47 additions and 0 deletions

18
Dockerfile Normal file
View file

@ -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"]

16
docker/docker-compose.yml Normal file
View file

@ -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"

5
docker/entrypoint.sh Normal file
View file

@ -0,0 +1,5 @@
#!/bin/bash
set -e
python3 -u /app/bin/import.py
python3 -u /app/bin/server.py

8
docker/settings.yaml Normal file
View file

@ -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'