From bdf6dd4e7757fc242acaa2bf918ef0b2ef374640 Mon Sep 17 00:00:00 2001 From: Evan Reichard Date: Sat, 20 Mar 2021 22:16:24 -0400 Subject: [PATCH] Docker configuration --- Dockerfile | 12 ++++++++++++ MANIFEST.in | 8 ++++---- README.md | 16 +++++++++------- docker-compose.yml | 8 ++++++++ setup.py | 2 +- 5 files changed, 34 insertions(+), 12 deletions(-) create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9ae48bf --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM python:3.9.2-slim as build +COPY . /app +WORKDIR /app +RUN python setup.py install + +FROM python:3.9.2-alpine3.13 +COPY --from=build /usr/local/lib/python3.9/site-packages /usr/local/lib/python3.9/site-packages + +RUN pip3 install gunicorn + +ENTRYPOINT ["gunicorn"] +CMD ["overseer:app", "--bind", "0.0.0.0:5000", "--threads=4"] diff --git a/MANIFEST.in b/MANIFEST.in index 7285a76..c8741f6 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,4 @@ -include src/overseer/static/* -include src/overseer/templates/* -include src/overseer/api/* -include src/overseer/api/v1/* +recursive-include src/overseer/api *.py +recursive-include src/overseer/static * +recursive-include src/overseer/resources * +recursive-include src/overseer/templates * diff --git a/README.md b/README.md index e2c59be..23359c3 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,15 @@ ## Description Overseer is a port scanning web interface. All current and historical results are stored in a database. +## Running +``` +# Be sure image is built +docker-compose build + +# Run compose in background. Service accessible via localhost:5000 +docker-compose up -d +``` + ## Developing ### Server @@ -30,13 +39,6 @@ You must run these commands from the `./src/overseer_client/` directory: yarn build ``` -## Running - -Ideally from a virtual env: -``` -overseer run -``` - # Notes In a production environment, it would be ideal to setup something like nginx to properly forward the `/api/*` routes to the Flask server, and all other endpoints to the static client resources. diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..e4701e3 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,8 @@ +--- +services: + overseer: + ports: + - '5000:5000' + build: . + volumes: + - .:/app diff --git a/setup.py b/setup.py index b770e04..964390d 100644 --- a/setup.py +++ b/setup.py @@ -11,9 +11,9 @@ setup( include_package_data=True, entry_points={"console_scripts": ["overseer = overseer:cli"]}, install_requires=[ - "Flask", "flask_socketio", "sqlalchemy", + "Flask", ], extras_require={"dev": ["pre-commit", "black", "flake8", "pytest"]}, )