build: Docker version
This commit is contained in:
		
							parent
							
								
									db7fcbfc3c
								
							
						
					
					
						commit
						5bd0596281
					
				
							
								
								
									
										33
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										33
									
								
								Makefile
									
									
									
									
									
								
							| @ -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: | install: | ||||||
| 	set -e ;\
 | 	set -e ;\
 | ||||||
| 	THSF_DIR=$$(pwd); \
 | 	python -m venv thsf_venv; \
 | ||||||
| 	echo [+] Déploiement dans $$THSF_DIR; \
 |  | ||||||
| 	python3 -m venv thsf_venv; \
 |  | ||||||
| 	. thsf_venv/bin/activate; \
 | 	. thsf_venv/bin/activate; \
 | ||||||
| 	pip3 install -r requirements.txt ;\
 | 	pip install -r requirements.txt ;\
 | ||||||
| 	pip3 install . ;\
 | 	pip install . ;\
 | ||||||
| 	pip3 install gunicorn; \
 | 	pip install gunicorn; \
 | ||||||
| 
 | 
 | ||||||
| run: | run: | ||||||
| 	set -e ;\
 | 	set -e ;\
 | ||||||
| 	THSF_DIR=$$(pwd); \
 | 	THSF_DIR=$$(pwd); \
 | ||||||
| 	echo [+] Démarrage dans $$THSF_DIR; \
 |  | ||||||
| 	. thsf_venv/bin/activate; \
 | 	. 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: | debug: | ||||||
| 	set -e ;\
 | 	set -e ;\
 | ||||||
| 	THSF_DIR=$$(pwd); \
 | 	THSF_DIR=$$(pwd); \
 | ||||||
| 	echo [+] Démarrage dans $$THSF_DIR; \
 |  | ||||||
| 	. thsf_venv/bin/activate; \
 | 	. 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: | stop: | ||||||
| 	-set -e;\
 | 	-set -e;\
 | ||||||
| 	THSF_DIR=$$(pwd); \
 | 	THSF_DIR=$$(pwd); \
 | ||||||
| 	echo [+] Arrêt dans $$THSF_DIR; \
 |  | ||||||
| 	kill -15 $$(cat $$THSF_DIR/thsf.pid); \
 | 	kill -15 $$(cat $$THSF_DIR/thsf.pid); \
 | ||||||
| 	rm thsf.pid | 	rm thsf.pid | ||||||
| 
 | 
 | ||||||
| clean: | clean: | ||||||
| 	-set -e ;\
 | 	-set -e ;\
 | ||||||
| 	THSF_DIR=$$(pwd); \
 | 	THSF_DIR=$$(pwd); \
 | ||||||
| 	echo [+] Nettoyage dans $$THSF_DIR; \
 |  | ||||||
| 	rm -Rf ./build ./src/thsf.egg-info ./thsf.pid ./thsf.log; \
 | 	rm -Rf ./build ./src/thsf.egg-info ./thsf.pid ./thsf.log; \
 | ||||||
| 	. thsf_venv/bin/activate; \
 | 	. thsf_venv/bin/activate; \
 | ||||||
| 	pip3 uninstall thsf -y | 	pip uninstall thsf -y | ||||||
| 
 | 
 | ||||||
| distclean: clean | distclean: clean | ||||||
| 	rm -Rf thsf_venv/ | 	rm -Rf thsf_venv/ | ||||||
| 
 | 
 | ||||||
| all: stop clean install run | 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 | ||||||
|  | |||||||
							
								
								
									
										10
									
								
								docker-compose.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								docker-compose.yml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,10 @@ | |||||||
|  | version: "2" | ||||||
|  | services: | ||||||
|  |   thsf: | ||||||
|  |     build: | ||||||
|  |       dockerfile: thsf.Dockerfile | ||||||
|  |       context: . | ||||||
|  |     ports: | ||||||
|  |       - "127.0.0.1:8042:8042" | ||||||
|  |     image: thsf:latest | ||||||
|  |     container_name: thsf | ||||||
							
								
								
									
										14
									
								
								thsf.Dockerfile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								thsf.Dockerfile
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,14 @@ | |||||||
|  | FROM python:3.9.16-bullseye as thsf_base | ||||||
|  | RUN apt-get update -y && \ | ||||||
|  |     apt-get install -y bash make python3-pip && \ | ||||||
|  |     useradd -m -d /home/thsf -s /bin/bash thsf | ||||||
|  | 
 | ||||||
|  | from thsf_base as thsf_build | ||||||
|  | COPY . /home/thsf/ | ||||||
|  | RUN chown -R thsf:thsf /home/thsf/ | ||||||
|  | USER thsf | ||||||
|  | WORKDIR /home/thsf/ | ||||||
|  | 
 | ||||||
|  | from thsf_build | ||||||
|  | RUN	make install | ||||||
|  | CMD ["make", "run"] | ||||||
							
								
								
									
										8
									
								
								thsf.net.code-workspace
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								thsf.net.code-workspace
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,8 @@ | |||||||
|  | { | ||||||
|  | 	"folders": [ | ||||||
|  | 		{ | ||||||
|  | 			"path": "." | ||||||
|  | 		} | ||||||
|  | 	], | ||||||
|  | 	"settings": {} | ||||||
|  | } | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 mco-system
						mco-system