diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..42e9d69 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM python +WORKDIR /usr/local/app + +COPY src ./ +RUN pip install --no-cache-dir -r requirements.txt + +EXPOSE 5000 + +RUN useradd app +USER app + +CMD ["gunicorn","-w 2", "-b 0.0.0.0:5000", "wsgi:app"] diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..d06dfac --- /dev/null +++ b/Makefile @@ -0,0 +1,11 @@ +APPLICATION = vm-experiments/jet-search +APP = jet-search + +build: + docker build -t $(APPLICATION) . + docker save -o $(APPLICATION).tar $(APPLICATION) + +install: + cp nginx /etc/nginx/sites-enabled/$(APP) + docker load -i $(APPLICATION) + docker run --name $(APPLICATION) --restart always -d $(APPLICATION) diff --git a/deploy/jet-search.service b/deploy/jet-search.service deleted file mode 100644 index 7de2724..0000000 --- a/deploy/jet-search.service +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=JetSearch Service -After=network.target - -[Service] -User=root -Group=root -WorkingDirectory=/root/jet-search -Environment="PATH=/root/jet-search/venv/bin" -ExecStart=/root/jet-search/venv/bin/gunicorn wsgi:app -b '127.0.0.1:5000' - -[Install] -WantedBy=multi-user.target \ No newline at end of file diff --git a/deploy/setup.sh b/deploy/setup.sh deleted file mode 100755 index abbbf37..0000000 --- a/deploy/setup.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -# This file is part of VM-Experiments. -# Licensed under the AGPL-3.0-or-later. See LICENSE for details. - -cd /root/jet-search/deploy/ -mv jet-search /etc/nginx/sites-enabled/ -mv jet-search.service /etc/systemd/system/ -systemctl enable jet-search.service -cd .. -python3 -m venv venv -source venv/bin/activate -pip install -r requirements.txt diff --git a/deploy/jet-search b/nginx similarity index 100% rename from deploy/jet-search rename to nginx diff --git a/requirements.txt b/src/requirements.txt similarity index 100% rename from requirements.txt rename to src/requirements.txt diff --git a/static/style.css b/src/static/style.css similarity index 100% rename from static/style.css rename to src/static/style.css diff --git a/templates/search.html b/src/templates/search.html similarity index 100% rename from templates/search.html rename to src/templates/search.html diff --git a/wsgi.py b/src/wsgi.py similarity index 100% rename from wsgi.py rename to src/wsgi.py