build: Docker version

This commit is contained in:
mco-system
2023-04-22 17:07:56 +11:00
parent db7fcbfc3c
commit 5bd0596281
4 changed files with 51 additions and 14 deletions

View File

@@ -1,45 +1,50 @@
.PHONY: clean distclean install run stop
.PHONY: clean distclean install run stop all docker-build docker-run docker-stop docker-all
install:
set -e ;\
THSF_DIR=$$(pwd); \
echo [+] Déploiement dans $$THSF_DIR; \
python3 -m venv thsf_venv; \
python -m venv thsf_venv; \
. thsf_venv/bin/activate; \
pip3 install -r requirements.txt ;\
pip3 install . ;\
pip3 install gunicorn; \
pip install -r requirements.txt ;\
pip install . ;\
pip install gunicorn; \
run:
set -e ;\
THSF_DIR=$$(pwd); \
echo [+] Démarrage dans $$THSF_DIR; \
. thsf_venv/bin/activate; \
thsf_venv/bin/gunicorn -D -p thsf.pid -w 4 -b 127.0.0.1:8042 'thsf:app'
thsf_venv/bin/gunicorn -p thsf.pid -w 4 -b 0.0.0.0:8042 'thsf:app'
debug:
set -e ;\
THSF_DIR=$$(pwd); \
echo [+] Démarrage dans $$THSF_DIR; \
. thsf_venv/bin/activate; \
thsf_venv/bin/gunicorn -p thsf.pid -w 4 -b 127.0.0.1:8042 'thsf:app'
thsf_venv/bin/gunicorn -p thsf.pid -w 4 -b 0.0.0.0:8042 'thsf:app'
stop:
-set -e;\
THSF_DIR=$$(pwd); \
echo [+] Arrêt dans $$THSF_DIR; \
kill -15 $$(cat $$THSF_DIR/thsf.pid); \
rm thsf.pid
clean:
-set -e ;\
THSF_DIR=$$(pwd); \
echo [+] Nettoyage dans $$THSF_DIR; \
rm -Rf ./build ./src/thsf.egg-info ./thsf.pid ./thsf.log; \
. thsf_venv/bin/activate; \
pip3 uninstall thsf -y
pip uninstall thsf -y
distclean: clean
rm -Rf thsf_venv/
all: stop clean install run
docker-build:
docker-compose build
docker-run:
docker-compose up -d
docker-stop:
-docker-compose down
docker-all: docker-stop docker-build docker-run